| 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: https://www.qt.io/licensing/ | - | ||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||||||||
| 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 https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||
| 15 | ** information use the contact form at https://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 3 as published by the Free Software | - | ||||||||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||
| 24 | ** | - | ||||||||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||
| 35 | ** | - | ||||||||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||
| 37 | ** | - | ||||||||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||||||||
| 39 | - | |||||||||||||||||||
| 40 | #include "qopengltexture.h" | - | ||||||||||||||||||
| 41 | #include "qopengltexture_p.h" | - | ||||||||||||||||||
| 42 | #include "qopengltexturehelper_p.h" | - | ||||||||||||||||||
| 43 | #include "qopenglfunctions.h" | - | ||||||||||||||||||
| 44 | #include <QtGui/qcolor.h> | - | ||||||||||||||||||
| 45 | #include <QtGui/qopenglcontext.h> | - | ||||||||||||||||||
| 46 | #include <private/qobject_p.h> | - | ||||||||||||||||||
| 47 | #include <private/qopenglcontext_p.h> | - | ||||||||||||||||||
| 48 | - | |||||||||||||||||||
| 49 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
| 50 | - | |||||||||||||||||||
| 51 | //this is to work around GL_TEXTURE_WRAP_R_OES which also has 0x8072 as value | - | ||||||||||||||||||
| 52 | #if !defined(GL_TEXTURE_WRAP_R) | - | ||||||||||||||||||
| 53 | #define GL_TEXTURE_WRAP_R 0x8072 | - | ||||||||||||||||||
| 54 | #endif | - | ||||||||||||||||||
| 55 | - | |||||||||||||||||||
| 56 | QOpenGLTexturePrivate::QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarget, | - | ||||||||||||||||||
| 57 | QOpenGLTexture *qq) | - | ||||||||||||||||||
| 58 | : q_ptr(qq), | - | ||||||||||||||||||
| 59 | context(0), | - | ||||||||||||||||||
| 60 | target(textureTarget), | - | ||||||||||||||||||
| 61 | textureId(0), | - | ||||||||||||||||||
| 62 | format(QOpenGLTexture::NoFormat), | - | ||||||||||||||||||
| 63 | formatClass(QOpenGLTexture::NoFormatClass), | - | ||||||||||||||||||
| 64 | requestedMipLevels(1), | - | ||||||||||||||||||
| 65 | mipLevels(-1), | - | ||||||||||||||||||
| 66 | layers(1), | - | ||||||||||||||||||
| 67 | faces(1), | - | ||||||||||||||||||
| 68 | samples(0), | - | ||||||||||||||||||
| 69 | fixedSamplePositions(true), | - | ||||||||||||||||||
| 70 | baseLevel(0), | - | ||||||||||||||||||
| 71 | maxLevel(1000), | - | ||||||||||||||||||
| 72 | depthStencilMode(QOpenGLTexture::DepthMode), | - | ||||||||||||||||||
| 73 | comparisonFunction(QOpenGLTexture::CompareLessEqual), | - | ||||||||||||||||||
| 74 | comparisonMode(QOpenGLTexture::CompareNone), | - | ||||||||||||||||||
| 75 | minFilter(QOpenGLTexture::Nearest), | - | ||||||||||||||||||
| 76 | magFilter(QOpenGLTexture::Nearest), | - | ||||||||||||||||||
| 77 | maxAnisotropy(1.0f), | - | ||||||||||||||||||
| 78 | minLevelOfDetail(-1000.0f), | - | ||||||||||||||||||
| 79 | maxLevelOfDetail(1000.0f), | - | ||||||||||||||||||
| 80 | levelOfDetailBias(0.0f), | - | ||||||||||||||||||
| 81 | textureView(false), | - | ||||||||||||||||||
| 82 | autoGenerateMipMaps(true), | - | ||||||||||||||||||
| 83 | storageAllocated(false), | - | ||||||||||||||||||
| 84 | texFuncs(0), | - | ||||||||||||||||||
| 85 | functions(0) | - | ||||||||||||||||||
| 86 | { | - | ||||||||||||||||||
| 87 | dimensions[0] = dimensions[1] = dimensions[2] = 1; | - | ||||||||||||||||||
| 88 | - | |||||||||||||||||||
| 89 | switch (target) { | - | ||||||||||||||||||
| 90 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 91 | bindingTarget = QOpenGLTexture::BindingTarget1D; | - | ||||||||||||||||||
| 92 | break; never executed: break; | 0 | ||||||||||||||||||
| 93 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 94 | bindingTarget = QOpenGLTexture::BindingTarget1DArray; | - | ||||||||||||||||||
| 95 | break; never executed: break; | 0 | ||||||||||||||||||
| 96 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 97 | bindingTarget = QOpenGLTexture::BindingTarget2D; | - | ||||||||||||||||||
| 98 | break; never executed: break; | 0 | ||||||||||||||||||
| 99 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 100 | bindingTarget = QOpenGLTexture::BindingTarget2DArray; | - | ||||||||||||||||||
| 101 | break; never executed: break; | 0 | ||||||||||||||||||
| 102 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 103 | bindingTarget = QOpenGLTexture::BindingTarget3D; | - | ||||||||||||||||||
| 104 | break; never executed: break; | 0 | ||||||||||||||||||
| 105 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 106 | bindingTarget = QOpenGLTexture::BindingTargetCubeMap; | - | ||||||||||||||||||
| 107 | faces = 6; | - | ||||||||||||||||||
| 108 | break; never executed: break; | 0 | ||||||||||||||||||
| 109 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 110 | bindingTarget = QOpenGLTexture::BindingTargetCubeMapArray; | - | ||||||||||||||||||
| 111 | faces = 6; | - | ||||||||||||||||||
| 112 | break; never executed: break; | 0 | ||||||||||||||||||
| 113 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 114 | bindingTarget = QOpenGLTexture::BindingTarget2DMultisample; | - | ||||||||||||||||||
| 115 | break; never executed: break; | 0 | ||||||||||||||||||
| 116 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 117 | bindingTarget = QOpenGLTexture::BindingTarget2DMultisampleArray; | - | ||||||||||||||||||
| 118 | break; never executed: break; | 0 | ||||||||||||||||||
| 119 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 120 | bindingTarget = QOpenGLTexture::BindingTargetRectangle; | - | ||||||||||||||||||
| 121 | break; never executed: break; | 0 | ||||||||||||||||||
| 122 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 123 | bindingTarget = QOpenGLTexture::BindingTargetBuffer; | - | ||||||||||||||||||
| 124 | break; never executed: break; | 0 | ||||||||||||||||||
| 125 | } | - | ||||||||||||||||||
| 126 | - | |||||||||||||||||||
| 127 | swizzleMask[0] = QOpenGLTexture::RedValue; | - | ||||||||||||||||||
| 128 | swizzleMask[1] = QOpenGLTexture::GreenValue; | - | ||||||||||||||||||
| 129 | swizzleMask[2] = QOpenGLTexture::BlueValue; | - | ||||||||||||||||||
| 130 | swizzleMask[3] = QOpenGLTexture::AlphaValue; | - | ||||||||||||||||||
| 131 | - | |||||||||||||||||||
| 132 | wrapModes[0] = wrapModes[1] = wrapModes[2] = target == QOpenGLTexture::TargetRectangle
| 0 | ||||||||||||||||||
| 133 | ? QOpenGLTexture::ClampToEdge : QOpenGLTexture::Repeat; | - | ||||||||||||||||||
| 134 | } never executed: end of block | 0 | ||||||||||||||||||
| 135 | - | |||||||||||||||||||
| 136 | QOpenGLTexturePrivate::~QOpenGLTexturePrivate() | - | ||||||||||||||||||
| 137 | { | - | ||||||||||||||||||
| 138 | destroy(); | - | ||||||||||||||||||
| 139 | } never executed: end of block | 0 | ||||||||||||||||||
| 140 | - | |||||||||||||||||||
| 141 | void QOpenGLTexturePrivate::initializeOpenGLFunctions() | - | ||||||||||||||||||
| 142 | { | - | ||||||||||||||||||
| 143 | // If we already have a functions object, there is nothing to do | - | ||||||||||||||||||
| 144 | if (texFuncs)
| 0 | ||||||||||||||||||
| 145 | return; never executed: return; | 0 | ||||||||||||||||||
| 146 | - | |||||||||||||||||||
| 147 | // See if the context already has a suitable resource we can use. | - | ||||||||||||||||||
| 148 | // If not create a functions object and add it to the context in case | - | ||||||||||||||||||
| 149 | // others wish to use it too | - | ||||||||||||||||||
| 150 | texFuncs = context->textureFunctions(); | - | ||||||||||||||||||
| 151 | if (!texFuncs) {
| 0 | ||||||||||||||||||
| 152 | texFuncs = new QOpenGLTextureHelper(context); | - | ||||||||||||||||||
| 153 | context->setTextureFunctions(texFuncs); | - | ||||||||||||||||||
| 154 | } never executed: end of block | 0 | ||||||||||||||||||
| 155 | } never executed: end of block | 0 | ||||||||||||||||||
| 156 | - | |||||||||||||||||||
| 157 | bool QOpenGLTexturePrivate::create() | - | ||||||||||||||||||
| 158 | { | - | ||||||||||||||||||
| 159 | if (textureId != 0)
| 0 | ||||||||||||||||||
| 160 | return true; never executed: return true; | 0 | ||||||||||||||||||
| 161 | - | |||||||||||||||||||
| 162 | QOpenGLContext *ctx = QOpenGLContext::currentContext(); | - | ||||||||||||||||||
| 163 | if (!ctx) {
| 0 | ||||||||||||||||||
| 164 | qWarning("Requires a valid current OpenGL context.\n" | - | ||||||||||||||||||
| 165 | "Texture has not been created"); | - | ||||||||||||||||||
| 166 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 167 | } | - | ||||||||||||||||||
| 168 | context = ctx; | - | ||||||||||||||||||
| 169 | functions = ctx->functions(); | - | ||||||||||||||||||
| 170 | - | |||||||||||||||||||
| 171 | // Resolve any functions we will need based upon context version and create the texture | - | ||||||||||||||||||
| 172 | initializeOpenGLFunctions(); | - | ||||||||||||||||||
| 173 | - | |||||||||||||||||||
| 174 | // What features do we have? | - | ||||||||||||||||||
| 175 | QOpenGLTexture::Feature feature = QOpenGLTexture::ImmutableStorage; | - | ||||||||||||||||||
| 176 | while (feature != QOpenGLTexture::MaxFeatureFlag) {
| 0 | ||||||||||||||||||
| 177 | if (QOpenGLTexture::hasFeature(feature))
| 0 | ||||||||||||||||||
| 178 | features |= feature; never executed: features |= feature; | 0 | ||||||||||||||||||
| 179 | feature = static_cast<QOpenGLTexture::Feature>(feature << 1); | - | ||||||||||||||||||
| 180 | } never executed: end of block | 0 | ||||||||||||||||||
| 181 | - | |||||||||||||||||||
| 182 | functions->glGenTextures(1, &textureId); | - | ||||||||||||||||||
| 183 | return textureId != 0; never executed: return textureId != 0; | 0 | ||||||||||||||||||
| 184 | } | - | ||||||||||||||||||
| 185 | - | |||||||||||||||||||
| 186 | void QOpenGLTexturePrivate::destroy() | - | ||||||||||||||||||
| 187 | { | - | ||||||||||||||||||
| 188 | if (!textureId) {
| 0 | ||||||||||||||||||
| 189 | // not created or already destroyed | - | ||||||||||||||||||
| 190 | return; never executed: return; | 0 | ||||||||||||||||||
| 191 | } | - | ||||||||||||||||||
| 192 | QOpenGLContext *currentContext = QOpenGLContext::currentContext(); | - | ||||||||||||||||||
| 193 | if (!currentContext || !QOpenGLContext::areSharing(currentContext, context)) {
| 0 | ||||||||||||||||||
| 194 | qWarning("Texture is not valid in the current context.\n" | - | ||||||||||||||||||
| 195 | "Texture has not been destroyed"); | - | ||||||||||||||||||
| 196 | return; never executed: return; | 0 | ||||||||||||||||||
| 197 | } | - | ||||||||||||||||||
| 198 | - | |||||||||||||||||||
| 199 | functions->glDeleteTextures(1, &textureId); | - | ||||||||||||||||||
| 200 | - | |||||||||||||||||||
| 201 | context = 0; | - | ||||||||||||||||||
| 202 | functions = 0; | - | ||||||||||||||||||
| 203 | textureId = 0; | - | ||||||||||||||||||
| 204 | format = QOpenGLTexture::NoFormat; | - | ||||||||||||||||||
| 205 | formatClass = QOpenGLTexture::NoFormatClass; | - | ||||||||||||||||||
| 206 | requestedMipLevels = 1; | - | ||||||||||||||||||
| 207 | mipLevels = -1; | - | ||||||||||||||||||
| 208 | layers = 1; | - | ||||||||||||||||||
| 209 | faces = 1; | - | ||||||||||||||||||
| 210 | samples = 0; | - | ||||||||||||||||||
| 211 | fixedSamplePositions = true, | - | ||||||||||||||||||
| 212 | baseLevel = 0; | - | ||||||||||||||||||
| 213 | maxLevel = 1000; | - | ||||||||||||||||||
| 214 | depthStencilMode = QOpenGLTexture::DepthMode; | - | ||||||||||||||||||
| 215 | minFilter = QOpenGLTexture::Nearest; | - | ||||||||||||||||||
| 216 | magFilter = QOpenGLTexture::Nearest; | - | ||||||||||||||||||
| 217 | maxAnisotropy = 1.0f; | - | ||||||||||||||||||
| 218 | minLevelOfDetail = -1000.0f; | - | ||||||||||||||||||
| 219 | maxLevelOfDetail = 1000.0f; | - | ||||||||||||||||||
| 220 | levelOfDetailBias = 0.0f; | - | ||||||||||||||||||
| 221 | textureView = false; | - | ||||||||||||||||||
| 222 | autoGenerateMipMaps = true; | - | ||||||||||||||||||
| 223 | storageAllocated = false; | - | ||||||||||||||||||
| 224 | texFuncs = 0; | - | ||||||||||||||||||
| 225 | - | |||||||||||||||||||
| 226 | swizzleMask[0] = QOpenGLTexture::RedValue; | - | ||||||||||||||||||
| 227 | swizzleMask[1] = QOpenGLTexture::GreenValue; | - | ||||||||||||||||||
| 228 | swizzleMask[2] = QOpenGLTexture::BlueValue; | - | ||||||||||||||||||
| 229 | swizzleMask[3] = QOpenGLTexture::AlphaValue; | - | ||||||||||||||||||
| 230 | - | |||||||||||||||||||
| 231 | wrapModes[0] = wrapModes[1] = wrapModes[2] = target == QOpenGLTexture::TargetRectangle
| 0 | ||||||||||||||||||
| 232 | ? QOpenGLTexture::ClampToEdge : QOpenGLTexture::Repeat; | - | ||||||||||||||||||
| 233 | } never executed: end of block | 0 | ||||||||||||||||||
| 234 | - | |||||||||||||||||||
| 235 | void QOpenGLTexturePrivate::bind() | - | ||||||||||||||||||
| 236 | { | - | ||||||||||||||||||
| 237 | functions->glBindTexture(target, textureId); | - | ||||||||||||||||||
| 238 | } never executed: end of block | 0 | ||||||||||||||||||
| 239 | - | |||||||||||||||||||
| 240 | void QOpenGLTexturePrivate::bind(uint unit, QOpenGLTexture::TextureUnitReset reset) | - | ||||||||||||||||||
| 241 | { | - | ||||||||||||||||||
| 242 | GLint oldTextureUnit = 0; | - | ||||||||||||||||||
| 243 | if (reset == QOpenGLTexture::ResetTextureUnit)
| 0 | ||||||||||||||||||
| 244 | functions->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit); never executed: functions->glGetIntegerv(0x84E0, &oldTextureUnit); | 0 | ||||||||||||||||||
| 245 | - | |||||||||||||||||||
| 246 | texFuncs->glActiveTexture(GL_TEXTURE0 + unit); | - | ||||||||||||||||||
| 247 | functions->glBindTexture(target, textureId); | - | ||||||||||||||||||
| 248 | - | |||||||||||||||||||
| 249 | if (reset == QOpenGLTexture::ResetTextureUnit)
| 0 | ||||||||||||||||||
| 250 | texFuncs->glActiveTexture(GL_TEXTURE0 + oldTextureUnit); never executed: texFuncs->glActiveTexture(0x84C0 + oldTextureUnit); | 0 | ||||||||||||||||||
| 251 | } never executed: end of block | 0 | ||||||||||||||||||
| 252 | - | |||||||||||||||||||
| 253 | void QOpenGLTexturePrivate::release() | - | ||||||||||||||||||
| 254 | { | - | ||||||||||||||||||
| 255 | functions->glBindTexture(target, 0); | - | ||||||||||||||||||
| 256 | } never executed: end of block | 0 | ||||||||||||||||||
| 257 | - | |||||||||||||||||||
| 258 | void QOpenGLTexturePrivate::release(uint unit, QOpenGLTexture::TextureUnitReset reset) | - | ||||||||||||||||||
| 259 | { | - | ||||||||||||||||||
| 260 | GLint oldTextureUnit = 0; | - | ||||||||||||||||||
| 261 | if (reset == QOpenGLTexture::ResetTextureUnit)
| 0 | ||||||||||||||||||
| 262 | functions->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit); never executed: functions->glGetIntegerv(0x84E0, &oldTextureUnit); | 0 | ||||||||||||||||||
| 263 | - | |||||||||||||||||||
| 264 | texFuncs->glActiveTexture(GL_TEXTURE0 + unit); | - | ||||||||||||||||||
| 265 | functions->glBindTexture(target, 0); | - | ||||||||||||||||||
| 266 | - | |||||||||||||||||||
| 267 | if (reset == QOpenGLTexture::ResetTextureUnit)
| 0 | ||||||||||||||||||
| 268 | texFuncs->glActiveTexture(GL_TEXTURE0 + oldTextureUnit); never executed: texFuncs->glActiveTexture(0x84C0 + oldTextureUnit); | 0 | ||||||||||||||||||
| 269 | } never executed: end of block | 0 | ||||||||||||||||||
| 270 | - | |||||||||||||||||||
| 271 | bool QOpenGLTexturePrivate::isBound() const | - | ||||||||||||||||||
| 272 | { | - | ||||||||||||||||||
| 273 | GLint boundTextureId = 0; | - | ||||||||||||||||||
| 274 | functions->glGetIntegerv(bindingTarget, &boundTextureId); | - | ||||||||||||||||||
| 275 | return (static_cast<GLuint>(boundTextureId) == textureId); never executed: return (static_cast<GLuint>(boundTextureId) == textureId); | 0 | ||||||||||||||||||
| 276 | } | - | ||||||||||||||||||
| 277 | - | |||||||||||||||||||
| 278 | bool QOpenGLTexturePrivate::isBound(uint unit) const | - | ||||||||||||||||||
| 279 | { | - | ||||||||||||||||||
| 280 | GLint oldTextureUnit = 0; | - | ||||||||||||||||||
| 281 | functions->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit); | - | ||||||||||||||||||
| 282 | - | |||||||||||||||||||
| 283 | GLint boundTextureId = 0; | - | ||||||||||||||||||
| 284 | texFuncs->glActiveTexture(GL_TEXTURE0 + unit); | - | ||||||||||||||||||
| 285 | functions->glGetIntegerv(bindingTarget, &boundTextureId); | - | ||||||||||||||||||
| 286 | bool result = (static_cast<GLuint>(boundTextureId) == textureId); | - | ||||||||||||||||||
| 287 | - | |||||||||||||||||||
| 288 | texFuncs->glActiveTexture(GL_TEXTURE0 + oldTextureUnit); | - | ||||||||||||||||||
| 289 | return result; never executed: return result; | 0 | ||||||||||||||||||
| 290 | } | - | ||||||||||||||||||
| 291 | - | |||||||||||||||||||
| 292 | int QOpenGLTexturePrivate::evaluateMipLevels() const | - | ||||||||||||||||||
| 293 | { | - | ||||||||||||||||||
| 294 | switch (target) { | - | ||||||||||||||||||
| 295 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 296 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 297 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 298 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 299 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 300 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 301 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 302 | return qMin(maximumMipLevelCount(), qMax(1, requestedMipLevels)); never executed: return qMin(maximumMipLevelCount(), qMax(1, requestedMipLevels)); | 0 | ||||||||||||||||||
| 303 | - | |||||||||||||||||||
| 304 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 305 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 306 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 307 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 308 | default: never executed: default: | 0 | ||||||||||||||||||
| 309 | return 1; never executed: return 1; | 0 | ||||||||||||||||||
| 310 | } | - | ||||||||||||||||||
| 311 | } | - | ||||||||||||||||||
| 312 | - | |||||||||||||||||||
| 313 | static bool isSizedTextureFormat(QOpenGLTexture::TextureFormat internalFormat) | - | ||||||||||||||||||
| 314 | { | - | ||||||||||||||||||
| 315 | switch (internalFormat) { | - | ||||||||||||||||||
| 316 | case QOpenGLTexture::NoFormat: never executed: case QOpenGLTexture::NoFormat: | 0 | ||||||||||||||||||
| 317 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 318 | - | |||||||||||||||||||
| 319 | case QOpenGLTexture::R8_UNorm: never executed: case QOpenGLTexture::R8_UNorm: | 0 | ||||||||||||||||||
| 320 | case QOpenGLTexture::RG8_UNorm: never executed: case QOpenGLTexture::RG8_UNorm: | 0 | ||||||||||||||||||
| 321 | case QOpenGLTexture::RGB8_UNorm: never executed: case QOpenGLTexture::RGB8_UNorm: | 0 | ||||||||||||||||||
| 322 | case QOpenGLTexture::RGBA8_UNorm: never executed: case QOpenGLTexture::RGBA8_UNorm: | 0 | ||||||||||||||||||
| 323 | case QOpenGLTexture::R16_UNorm: never executed: case QOpenGLTexture::R16_UNorm: | 0 | ||||||||||||||||||
| 324 | case QOpenGLTexture::RG16_UNorm: never executed: case QOpenGLTexture::RG16_UNorm: | 0 | ||||||||||||||||||
| 325 | case QOpenGLTexture::RGB16_UNorm: never executed: case QOpenGLTexture::RGB16_UNorm: | 0 | ||||||||||||||||||
| 326 | case QOpenGLTexture::RGBA16_UNorm: never executed: case QOpenGLTexture::RGBA16_UNorm: | 0 | ||||||||||||||||||
| 327 | case QOpenGLTexture::R8_SNorm: never executed: case QOpenGLTexture::R8_SNorm: | 0 | ||||||||||||||||||
| 328 | case QOpenGLTexture::RG8_SNorm: never executed: case QOpenGLTexture::RG8_SNorm: | 0 | ||||||||||||||||||
| 329 | case QOpenGLTexture::RGB8_SNorm: never executed: case QOpenGLTexture::RGB8_SNorm: | 0 | ||||||||||||||||||
| 330 | case QOpenGLTexture::RGBA8_SNorm: never executed: case QOpenGLTexture::RGBA8_SNorm: | 0 | ||||||||||||||||||
| 331 | case QOpenGLTexture::R16_SNorm: never executed: case QOpenGLTexture::R16_SNorm: | 0 | ||||||||||||||||||
| 332 | case QOpenGLTexture::RG16_SNorm: never executed: case QOpenGLTexture::RG16_SNorm: | 0 | ||||||||||||||||||
| 333 | case QOpenGLTexture::RGB16_SNorm: never executed: case QOpenGLTexture::RGB16_SNorm: | 0 | ||||||||||||||||||
| 334 | case QOpenGLTexture::RGBA16_SNorm: never executed: case QOpenGLTexture::RGBA16_SNorm: | 0 | ||||||||||||||||||
| 335 | case QOpenGLTexture::R8U: never executed: case QOpenGLTexture::R8U: | 0 | ||||||||||||||||||
| 336 | case QOpenGLTexture::RG8U: never executed: case QOpenGLTexture::RG8U: | 0 | ||||||||||||||||||
| 337 | case QOpenGLTexture::RGB8U: never executed: case QOpenGLTexture::RGB8U: | 0 | ||||||||||||||||||
| 338 | case QOpenGLTexture::RGBA8U: never executed: case QOpenGLTexture::RGBA8U: | 0 | ||||||||||||||||||
| 339 | case QOpenGLTexture::R16U: never executed: case QOpenGLTexture::R16U: | 0 | ||||||||||||||||||
| 340 | case QOpenGLTexture::RG16U: never executed: case QOpenGLTexture::RG16U: | 0 | ||||||||||||||||||
| 341 | case QOpenGLTexture::RGB16U: never executed: case QOpenGLTexture::RGB16U: | 0 | ||||||||||||||||||
| 342 | case QOpenGLTexture::RGBA16U: never executed: case QOpenGLTexture::RGBA16U: | 0 | ||||||||||||||||||
| 343 | case QOpenGLTexture::R32U: never executed: case QOpenGLTexture::R32U: | 0 | ||||||||||||||||||
| 344 | case QOpenGLTexture::RG32U: never executed: case QOpenGLTexture::RG32U: | 0 | ||||||||||||||||||
| 345 | case QOpenGLTexture::RGB32U: never executed: case QOpenGLTexture::RGB32U: | 0 | ||||||||||||||||||
| 346 | case QOpenGLTexture::RGBA32U: never executed: case QOpenGLTexture::RGBA32U: | 0 | ||||||||||||||||||
| 347 | case QOpenGLTexture::R8I: never executed: case QOpenGLTexture::R8I: | 0 | ||||||||||||||||||
| 348 | case QOpenGLTexture::RG8I: never executed: case QOpenGLTexture::RG8I: | 0 | ||||||||||||||||||
| 349 | case QOpenGLTexture::RGB8I: never executed: case QOpenGLTexture::RGB8I: | 0 | ||||||||||||||||||
| 350 | case QOpenGLTexture::RGBA8I: never executed: case QOpenGLTexture::RGBA8I: | 0 | ||||||||||||||||||
| 351 | case QOpenGLTexture::R16I: never executed: case QOpenGLTexture::R16I: | 0 | ||||||||||||||||||
| 352 | case QOpenGLTexture::RG16I: never executed: case QOpenGLTexture::RG16I: | 0 | ||||||||||||||||||
| 353 | case QOpenGLTexture::RGB16I: never executed: case QOpenGLTexture::RGB16I: | 0 | ||||||||||||||||||
| 354 | case QOpenGLTexture::RGBA16I: never executed: case QOpenGLTexture::RGBA16I: | 0 | ||||||||||||||||||
| 355 | case QOpenGLTexture::R32I: never executed: case QOpenGLTexture::R32I: | 0 | ||||||||||||||||||
| 356 | case QOpenGLTexture::RG32I: never executed: case QOpenGLTexture::RG32I: | 0 | ||||||||||||||||||
| 357 | case QOpenGLTexture::RGB32I: never executed: case QOpenGLTexture::RGB32I: | 0 | ||||||||||||||||||
| 358 | case QOpenGLTexture::RGBA32I: never executed: case QOpenGLTexture::RGBA32I: | 0 | ||||||||||||||||||
| 359 | case QOpenGLTexture::R16F: never executed: case QOpenGLTexture::R16F: | 0 | ||||||||||||||||||
| 360 | case QOpenGLTexture::RG16F: never executed: case QOpenGLTexture::RG16F: | 0 | ||||||||||||||||||
| 361 | case QOpenGLTexture::RGB16F: never executed: case QOpenGLTexture::RGB16F: | 0 | ||||||||||||||||||
| 362 | case QOpenGLTexture::RGBA16F: never executed: case QOpenGLTexture::RGBA16F: | 0 | ||||||||||||||||||
| 363 | case QOpenGLTexture::R32F: never executed: case QOpenGLTexture::R32F: | 0 | ||||||||||||||||||
| 364 | case QOpenGLTexture::RG32F: never executed: case QOpenGLTexture::RG32F: | 0 | ||||||||||||||||||
| 365 | case QOpenGLTexture::RGB32F: never executed: case QOpenGLTexture::RGB32F: | 0 | ||||||||||||||||||
| 366 | case QOpenGLTexture::RGBA32F: never executed: case QOpenGLTexture::RGBA32F: | 0 | ||||||||||||||||||
| 367 | case QOpenGLTexture::RGB9E5: never executed: case QOpenGLTexture::RGB9E5: | 0 | ||||||||||||||||||
| 368 | case QOpenGLTexture::RG11B10F: never executed: case QOpenGLTexture::RG11B10F: | 0 | ||||||||||||||||||
| 369 | case QOpenGLTexture::RG3B2: never executed: case QOpenGLTexture::RG3B2: | 0 | ||||||||||||||||||
| 370 | case QOpenGLTexture::R5G6B5: never executed: case QOpenGLTexture::R5G6B5: | 0 | ||||||||||||||||||
| 371 | case QOpenGLTexture::RGB5A1: never executed: case QOpenGLTexture::RGB5A1: | 0 | ||||||||||||||||||
| 372 | case QOpenGLTexture::RGBA4: never executed: case QOpenGLTexture::RGBA4: | 0 | ||||||||||||||||||
| 373 | case QOpenGLTexture::RGB10A2: never executed: case QOpenGLTexture::RGB10A2: | 0 | ||||||||||||||||||
| 374 | - | |||||||||||||||||||
| 375 | case QOpenGLTexture::D16: never executed: case QOpenGLTexture::D16: | 0 | ||||||||||||||||||
| 376 | case QOpenGLTexture::D24: never executed: case QOpenGLTexture::D24: | 0 | ||||||||||||||||||
| 377 | case QOpenGLTexture::D32: never executed: case QOpenGLTexture::D32: | 0 | ||||||||||||||||||
| 378 | case QOpenGLTexture::D32F: never executed: case QOpenGLTexture::D32F: | 0 | ||||||||||||||||||
| 379 | - | |||||||||||||||||||
| 380 | case QOpenGLTexture::D24S8: never executed: case QOpenGLTexture::D24S8: | 0 | ||||||||||||||||||
| 381 | case QOpenGLTexture::D32FS8X24: never executed: case QOpenGLTexture::D32FS8X24: | 0 | ||||||||||||||||||
| 382 | - | |||||||||||||||||||
| 383 | case QOpenGLTexture::S8: never executed: case QOpenGLTexture::S8: | 0 | ||||||||||||||||||
| 384 | - | |||||||||||||||||||
| 385 | case QOpenGLTexture::RGB_DXT1: never executed: case QOpenGLTexture::RGB_DXT1: | 0 | ||||||||||||||||||
| 386 | case QOpenGLTexture::RGBA_DXT1: never executed: case QOpenGLTexture::RGBA_DXT1: | 0 | ||||||||||||||||||
| 387 | case QOpenGLTexture::RGBA_DXT3: never executed: case QOpenGLTexture::RGBA_DXT3: | 0 | ||||||||||||||||||
| 388 | case QOpenGLTexture::RGBA_DXT5: never executed: case QOpenGLTexture::RGBA_DXT5: | 0 | ||||||||||||||||||
| 389 | case QOpenGLTexture::R_ATI1N_UNorm: never executed: case QOpenGLTexture::R_ATI1N_UNorm: | 0 | ||||||||||||||||||
| 390 | case QOpenGLTexture::R_ATI1N_SNorm: never executed: case QOpenGLTexture::R_ATI1N_SNorm: | 0 | ||||||||||||||||||
| 391 | case QOpenGLTexture::RG_ATI2N_UNorm: never executed: case QOpenGLTexture::RG_ATI2N_UNorm: | 0 | ||||||||||||||||||
| 392 | case QOpenGLTexture::RG_ATI2N_SNorm: never executed: case QOpenGLTexture::RG_ATI2N_SNorm: | 0 | ||||||||||||||||||
| 393 | case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT: never executed: case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT: | 0 | ||||||||||||||||||
| 394 | case QOpenGLTexture::RGB_BP_SIGNED_FLOAT: never executed: case QOpenGLTexture::RGB_BP_SIGNED_FLOAT: | 0 | ||||||||||||||||||
| 395 | case QOpenGLTexture::RGB_BP_UNorm: never executed: case QOpenGLTexture::RGB_BP_UNorm: | 0 | ||||||||||||||||||
| 396 | case QOpenGLTexture::SRGB8: never executed: case QOpenGLTexture::SRGB8: | 0 | ||||||||||||||||||
| 397 | case QOpenGLTexture::SRGB8_Alpha8: never executed: case QOpenGLTexture::SRGB8_Alpha8: | 0 | ||||||||||||||||||
| 398 | case QOpenGLTexture::SRGB_DXT1: never executed: case QOpenGLTexture::SRGB_DXT1: | 0 | ||||||||||||||||||
| 399 | case QOpenGLTexture::SRGB_Alpha_DXT1: never executed: case QOpenGLTexture::SRGB_Alpha_DXT1: | 0 | ||||||||||||||||||
| 400 | case QOpenGLTexture::SRGB_Alpha_DXT3: never executed: case QOpenGLTexture::SRGB_Alpha_DXT3: | 0 | ||||||||||||||||||
| 401 | case QOpenGLTexture::SRGB_Alpha_DXT5: never executed: case QOpenGLTexture::SRGB_Alpha_DXT5: | 0 | ||||||||||||||||||
| 402 | case QOpenGLTexture::SRGB_BP_UNorm: never executed: case QOpenGLTexture::SRGB_BP_UNorm: | 0 | ||||||||||||||||||
| 403 | case QOpenGLTexture::R11_EAC_UNorm: never executed: case QOpenGLTexture::R11_EAC_UNorm: | 0 | ||||||||||||||||||
| 404 | case QOpenGLTexture::R11_EAC_SNorm: never executed: case QOpenGLTexture::R11_EAC_SNorm: | 0 | ||||||||||||||||||
| 405 | case QOpenGLTexture::RG11_EAC_UNorm: never executed: case QOpenGLTexture::RG11_EAC_UNorm: | 0 | ||||||||||||||||||
| 406 | case QOpenGLTexture::RG11_EAC_SNorm: never executed: case QOpenGLTexture::RG11_EAC_SNorm: | 0 | ||||||||||||||||||
| 407 | case QOpenGLTexture::RGB8_ETC2: never executed: case QOpenGLTexture::RGB8_ETC2: | 0 | ||||||||||||||||||
| 408 | case QOpenGLTexture::SRGB8_ETC2: never executed: case QOpenGLTexture::SRGB8_ETC2: | 0 | ||||||||||||||||||
| 409 | case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 410 | case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 411 | case QOpenGLTexture::RGBA8_ETC2_EAC: never executed: case QOpenGLTexture::RGBA8_ETC2_EAC: | 0 | ||||||||||||||||||
| 412 | case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: never executed: case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: | 0 | ||||||||||||||||||
| 413 | return true; never executed: return true; | 0 | ||||||||||||||||||
| 414 | - | |||||||||||||||||||
| 415 | case QOpenGLTexture::RGB8_ETC1: never executed: case QOpenGLTexture::RGB8_ETC1: | 0 | ||||||||||||||||||
| 416 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 417 | - | |||||||||||||||||||
| 418 | case QOpenGLTexture::DepthFormat: never executed: case QOpenGLTexture::DepthFormat: | 0 | ||||||||||||||||||
| 419 | case QOpenGLTexture::AlphaFormat: never executed: case QOpenGLTexture::AlphaFormat: | 0 | ||||||||||||||||||
| 420 | - | |||||||||||||||||||
| 421 | case QOpenGLTexture::RGBFormat: never executed: case QOpenGLTexture::RGBFormat: | 0 | ||||||||||||||||||
| 422 | case QOpenGLTexture::RGBAFormat: never executed: case QOpenGLTexture::RGBAFormat: | 0 | ||||||||||||||||||
| 423 | - | |||||||||||||||||||
| 424 | case QOpenGLTexture::LuminanceFormat: never executed: case QOpenGLTexture::LuminanceFormat: | 0 | ||||||||||||||||||
| 425 | - | |||||||||||||||||||
| 426 | case QOpenGLTexture::LuminanceAlphaFormat: never executed: case QOpenGLTexture::LuminanceAlphaFormat: | 0 | ||||||||||||||||||
| 427 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 428 | } | - | ||||||||||||||||||
| 429 | - | |||||||||||||||||||
| 430 | Q_UNREACHABLE(); | - | ||||||||||||||||||
| 431 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 432 | } | - | ||||||||||||||||||
| 433 | - | |||||||||||||||||||
| 434 | static bool isTextureTargetMultisample(QOpenGLTexture::Target target) | - | ||||||||||||||||||
| 435 | { | - | ||||||||||||||||||
| 436 | switch (target) { | - | ||||||||||||||||||
| 437 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 438 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 439 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 440 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 441 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 442 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 443 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 444 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 445 | - | |||||||||||||||||||
| 446 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 447 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 448 | return true; never executed: return true; | 0 | ||||||||||||||||||
| 449 | - | |||||||||||||||||||
| 450 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 451 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 452 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 453 | } | - | ||||||||||||||||||
| 454 | - | |||||||||||||||||||
| 455 | Q_UNREACHABLE(); | - | ||||||||||||||||||
| 456 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 457 | } | - | ||||||||||||||||||
| 458 | - | |||||||||||||||||||
| 459 | bool QOpenGLTexturePrivate::isUsingImmutableStorage() const | - | ||||||||||||||||||
| 460 | { | - | ||||||||||||||||||
| 461 | // Use immutable storage whenever possible, falling back to mutable | - | ||||||||||||||||||
| 462 | // Note that if multisample textures are not supported at all, we'll still fail into | - | ||||||||||||||||||
| 463 | // the mutable storage allocation | - | ||||||||||||||||||
| 464 | return isSizedTextureFormat(format) never executed: return isSizedTextureFormat(format) && (isTextureTargetMultisample(target) ? features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage) : features.testFlag(QOpenGLTexture::ImmutableStorage)); | 0 | ||||||||||||||||||
| 465 | && (isTextureTargetMultisample(target) never executed: return isSizedTextureFormat(format) && (isTextureTargetMultisample(target) ? features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage) : features.testFlag(QOpenGLTexture::ImmutableStorage)); | 0 | ||||||||||||||||||
| 466 | ? features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage) never executed: return isSizedTextureFormat(format) && (isTextureTargetMultisample(target) ? features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage) : features.testFlag(QOpenGLTexture::ImmutableStorage)); | 0 | ||||||||||||||||||
| 467 | : features.testFlag(QOpenGLTexture::ImmutableStorage)); never executed: return isSizedTextureFormat(format) && (isTextureTargetMultisample(target) ? features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage) : features.testFlag(QOpenGLTexture::ImmutableStorage)); | 0 | ||||||||||||||||||
| 468 | } | - | ||||||||||||||||||
| 469 | - | |||||||||||||||||||
| 470 | void QOpenGLTexturePrivate::allocateStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType) | - | ||||||||||||||||||
| 471 | { | - | ||||||||||||||||||
| 472 | // Resolve the actual number of mipmap levels we can use | - | ||||||||||||||||||
| 473 | mipLevels = evaluateMipLevels(); | - | ||||||||||||||||||
| 474 | - | |||||||||||||||||||
| 475 | if (isUsingImmutableStorage())
| 0 | ||||||||||||||||||
| 476 | allocateImmutableStorage(); never executed: allocateImmutableStorage(); | 0 | ||||||||||||||||||
| 477 | else | - | ||||||||||||||||||
| 478 | allocateMutableStorage(pixelFormat, pixelType); never executed: allocateMutableStorage(pixelFormat, pixelType); | 0 | ||||||||||||||||||
| 479 | } | - | ||||||||||||||||||
| 480 | - | |||||||||||||||||||
| 481 | static QOpenGLTexture::PixelFormat pixelFormatCompatibleWithInternalFormat(QOpenGLTexture::TextureFormat internalFormat) | - | ||||||||||||||||||
| 482 | { | - | ||||||||||||||||||
| 483 | switch (internalFormat) { | - | ||||||||||||||||||
| 484 | case QOpenGLTexture::NoFormat: never executed: case QOpenGLTexture::NoFormat: | 0 | ||||||||||||||||||
| 485 | return QOpenGLTexture::NoSourceFormat; never executed: return QOpenGLTexture::NoSourceFormat; | 0 | ||||||||||||||||||
| 486 | - | |||||||||||||||||||
| 487 | case QOpenGLTexture::R8_UNorm: never executed: case QOpenGLTexture::R8_UNorm: | 0 | ||||||||||||||||||
| 488 | return QOpenGLTexture::Red; never executed: return QOpenGLTexture::Red; | 0 | ||||||||||||||||||
| 489 | - | |||||||||||||||||||
| 490 | case QOpenGLTexture::RG8_UNorm: never executed: case QOpenGLTexture::RG8_UNorm: | 0 | ||||||||||||||||||
| 491 | return QOpenGLTexture::RG; never executed: return QOpenGLTexture::RG; | 0 | ||||||||||||||||||
| 492 | - | |||||||||||||||||||
| 493 | case QOpenGLTexture::RGB8_UNorm: never executed: case QOpenGLTexture::RGB8_UNorm: | 0 | ||||||||||||||||||
| 494 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 495 | - | |||||||||||||||||||
| 496 | case QOpenGLTexture::RGBA8_UNorm: never executed: case QOpenGLTexture::RGBA8_UNorm: | 0 | ||||||||||||||||||
| 497 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 498 | - | |||||||||||||||||||
| 499 | case QOpenGLTexture::R16_UNorm: never executed: case QOpenGLTexture::R16_UNorm: | 0 | ||||||||||||||||||
| 500 | return QOpenGLTexture::Red; never executed: return QOpenGLTexture::Red; | 0 | ||||||||||||||||||
| 501 | - | |||||||||||||||||||
| 502 | case QOpenGLTexture::RG16_UNorm: never executed: case QOpenGLTexture::RG16_UNorm: | 0 | ||||||||||||||||||
| 503 | return QOpenGLTexture::RG; never executed: return QOpenGLTexture::RG; | 0 | ||||||||||||||||||
| 504 | - | |||||||||||||||||||
| 505 | case QOpenGLTexture::RGB16_UNorm: never executed: case QOpenGLTexture::RGB16_UNorm: | 0 | ||||||||||||||||||
| 506 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 507 | - | |||||||||||||||||||
| 508 | case QOpenGLTexture::RGBA16_UNorm: never executed: case QOpenGLTexture::RGBA16_UNorm: | 0 | ||||||||||||||||||
| 509 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 510 | - | |||||||||||||||||||
| 511 | case QOpenGLTexture::R8_SNorm: never executed: case QOpenGLTexture::R8_SNorm: | 0 | ||||||||||||||||||
| 512 | return QOpenGLTexture::Red; never executed: return QOpenGLTexture::Red; | 0 | ||||||||||||||||||
| 513 | - | |||||||||||||||||||
| 514 | case QOpenGLTexture::RG8_SNorm: never executed: case QOpenGLTexture::RG8_SNorm: | 0 | ||||||||||||||||||
| 515 | return QOpenGLTexture::RG; never executed: return QOpenGLTexture::RG; | 0 | ||||||||||||||||||
| 516 | - | |||||||||||||||||||
| 517 | case QOpenGLTexture::RGB8_SNorm: never executed: case QOpenGLTexture::RGB8_SNorm: | 0 | ||||||||||||||||||
| 518 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 519 | - | |||||||||||||||||||
| 520 | case QOpenGLTexture::RGBA8_SNorm: never executed: case QOpenGLTexture::RGBA8_SNorm: | 0 | ||||||||||||||||||
| 521 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 522 | - | |||||||||||||||||||
| 523 | case QOpenGLTexture::R16_SNorm: never executed: case QOpenGLTexture::R16_SNorm: | 0 | ||||||||||||||||||
| 524 | return QOpenGLTexture::Red; never executed: return QOpenGLTexture::Red; | 0 | ||||||||||||||||||
| 525 | - | |||||||||||||||||||
| 526 | case QOpenGLTexture::RG16_SNorm: never executed: case QOpenGLTexture::RG16_SNorm: | 0 | ||||||||||||||||||
| 527 | return QOpenGLTexture::RG; never executed: return QOpenGLTexture::RG; | 0 | ||||||||||||||||||
| 528 | - | |||||||||||||||||||
| 529 | case QOpenGLTexture::RGB16_SNorm: never executed: case QOpenGLTexture::RGB16_SNorm: | 0 | ||||||||||||||||||
| 530 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 531 | - | |||||||||||||||||||
| 532 | case QOpenGLTexture::RGBA16_SNorm: never executed: case QOpenGLTexture::RGBA16_SNorm: | 0 | ||||||||||||||||||
| 533 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 534 | - | |||||||||||||||||||
| 535 | case QOpenGLTexture::R8U: never executed: case QOpenGLTexture::R8U: | 0 | ||||||||||||||||||
| 536 | return QOpenGLTexture::Red_Integer; never executed: return QOpenGLTexture::Red_Integer; | 0 | ||||||||||||||||||
| 537 | - | |||||||||||||||||||
| 538 | case QOpenGLTexture::RG8U: never executed: case QOpenGLTexture::RG8U: | 0 | ||||||||||||||||||
| 539 | return QOpenGLTexture::RG_Integer; never executed: return QOpenGLTexture::RG_Integer; | 0 | ||||||||||||||||||
| 540 | - | |||||||||||||||||||
| 541 | case QOpenGLTexture::RGB8U: never executed: case QOpenGLTexture::RGB8U: | 0 | ||||||||||||||||||
| 542 | return QOpenGLTexture::RGB_Integer; never executed: return QOpenGLTexture::RGB_Integer; | 0 | ||||||||||||||||||
| 543 | - | |||||||||||||||||||
| 544 | case QOpenGLTexture::RGBA8U: never executed: case QOpenGLTexture::RGBA8U: | 0 | ||||||||||||||||||
| 545 | return QOpenGLTexture::RGBA_Integer; never executed: return QOpenGLTexture::RGBA_Integer; | 0 | ||||||||||||||||||
| 546 | - | |||||||||||||||||||
| 547 | case QOpenGLTexture::R16U: never executed: case QOpenGLTexture::R16U: | 0 | ||||||||||||||||||
| 548 | return QOpenGLTexture::Red_Integer; never executed: return QOpenGLTexture::Red_Integer; | 0 | ||||||||||||||||||
| 549 | - | |||||||||||||||||||
| 550 | case QOpenGLTexture::RG16U: never executed: case QOpenGLTexture::RG16U: | 0 | ||||||||||||||||||
| 551 | return QOpenGLTexture::RG_Integer; never executed: return QOpenGLTexture::RG_Integer; | 0 | ||||||||||||||||||
| 552 | - | |||||||||||||||||||
| 553 | case QOpenGLTexture::RGB16U: never executed: case QOpenGLTexture::RGB16U: | 0 | ||||||||||||||||||
| 554 | return QOpenGLTexture::RGB_Integer; never executed: return QOpenGLTexture::RGB_Integer; | 0 | ||||||||||||||||||
| 555 | - | |||||||||||||||||||
| 556 | case QOpenGLTexture::RGBA16U: never executed: case QOpenGLTexture::RGBA16U: | 0 | ||||||||||||||||||
| 557 | return QOpenGLTexture::RGBA_Integer; never executed: return QOpenGLTexture::RGBA_Integer; | 0 | ||||||||||||||||||
| 558 | - | |||||||||||||||||||
| 559 | case QOpenGLTexture::R32U: never executed: case QOpenGLTexture::R32U: | 0 | ||||||||||||||||||
| 560 | return QOpenGLTexture::Red_Integer; never executed: return QOpenGLTexture::Red_Integer; | 0 | ||||||||||||||||||
| 561 | - | |||||||||||||||||||
| 562 | case QOpenGLTexture::RG32U: never executed: case QOpenGLTexture::RG32U: | 0 | ||||||||||||||||||
| 563 | return QOpenGLTexture::RG_Integer; never executed: return QOpenGLTexture::RG_Integer; | 0 | ||||||||||||||||||
| 564 | - | |||||||||||||||||||
| 565 | case QOpenGLTexture::RGB32U: never executed: case QOpenGLTexture::RGB32U: | 0 | ||||||||||||||||||
| 566 | return QOpenGLTexture::RGB_Integer; never executed: return QOpenGLTexture::RGB_Integer; | 0 | ||||||||||||||||||
| 567 | - | |||||||||||||||||||
| 568 | case QOpenGLTexture::RGBA32U: never executed: case QOpenGLTexture::RGBA32U: | 0 | ||||||||||||||||||
| 569 | return QOpenGLTexture::RGBA_Integer; never executed: return QOpenGLTexture::RGBA_Integer; | 0 | ||||||||||||||||||
| 570 | - | |||||||||||||||||||
| 571 | case QOpenGLTexture::R8I: never executed: case QOpenGLTexture::R8I: | 0 | ||||||||||||||||||
| 572 | return QOpenGLTexture::Red_Integer; never executed: return QOpenGLTexture::Red_Integer; | 0 | ||||||||||||||||||
| 573 | - | |||||||||||||||||||
| 574 | case QOpenGLTexture::RG8I: never executed: case QOpenGLTexture::RG8I: | 0 | ||||||||||||||||||
| 575 | return QOpenGLTexture::RG_Integer; never executed: return QOpenGLTexture::RG_Integer; | 0 | ||||||||||||||||||
| 576 | - | |||||||||||||||||||
| 577 | case QOpenGLTexture::RGB8I: never executed: case QOpenGLTexture::RGB8I: | 0 | ||||||||||||||||||
| 578 | return QOpenGLTexture::RGB_Integer; never executed: return QOpenGLTexture::RGB_Integer; | 0 | ||||||||||||||||||
| 579 | - | |||||||||||||||||||
| 580 | case QOpenGLTexture::RGBA8I: never executed: case QOpenGLTexture::RGBA8I: | 0 | ||||||||||||||||||
| 581 | return QOpenGLTexture::RGBA_Integer; never executed: return QOpenGLTexture::RGBA_Integer; | 0 | ||||||||||||||||||
| 582 | - | |||||||||||||||||||
| 583 | case QOpenGLTexture::R16I: never executed: case QOpenGLTexture::R16I: | 0 | ||||||||||||||||||
| 584 | return QOpenGLTexture::Red_Integer; never executed: return QOpenGLTexture::Red_Integer; | 0 | ||||||||||||||||||
| 585 | - | |||||||||||||||||||
| 586 | case QOpenGLTexture::RG16I: never executed: case QOpenGLTexture::RG16I: | 0 | ||||||||||||||||||
| 587 | return QOpenGLTexture::RG_Integer; never executed: return QOpenGLTexture::RG_Integer; | 0 | ||||||||||||||||||
| 588 | - | |||||||||||||||||||
| 589 | case QOpenGLTexture::RGB16I: never executed: case QOpenGLTexture::RGB16I: | 0 | ||||||||||||||||||
| 590 | return QOpenGLTexture::RGB_Integer; never executed: return QOpenGLTexture::RGB_Integer; | 0 | ||||||||||||||||||
| 591 | - | |||||||||||||||||||
| 592 | case QOpenGLTexture::RGBA16I: never executed: case QOpenGLTexture::RGBA16I: | 0 | ||||||||||||||||||
| 593 | return QOpenGLTexture::RGBA_Integer; never executed: return QOpenGLTexture::RGBA_Integer; | 0 | ||||||||||||||||||
| 594 | - | |||||||||||||||||||
| 595 | case QOpenGLTexture::R32I: never executed: case QOpenGLTexture::R32I: | 0 | ||||||||||||||||||
| 596 | return QOpenGLTexture::Red_Integer; never executed: return QOpenGLTexture::Red_Integer; | 0 | ||||||||||||||||||
| 597 | - | |||||||||||||||||||
| 598 | case QOpenGLTexture::RG32I: never executed: case QOpenGLTexture::RG32I: | 0 | ||||||||||||||||||
| 599 | return QOpenGLTexture::RG_Integer; never executed: return QOpenGLTexture::RG_Integer; | 0 | ||||||||||||||||||
| 600 | - | |||||||||||||||||||
| 601 | case QOpenGLTexture::RGB32I: never executed: case QOpenGLTexture::RGB32I: | 0 | ||||||||||||||||||
| 602 | return QOpenGLTexture::RGB_Integer; never executed: return QOpenGLTexture::RGB_Integer; | 0 | ||||||||||||||||||
| 603 | - | |||||||||||||||||||
| 604 | case QOpenGLTexture::RGBA32I: never executed: case QOpenGLTexture::RGBA32I: | 0 | ||||||||||||||||||
| 605 | return QOpenGLTexture::RGBA_Integer; never executed: return QOpenGLTexture::RGBA_Integer; | 0 | ||||||||||||||||||
| 606 | - | |||||||||||||||||||
| 607 | case QOpenGLTexture::R16F: never executed: case QOpenGLTexture::R16F: | 0 | ||||||||||||||||||
| 608 | return QOpenGLTexture::Red; never executed: return QOpenGLTexture::Red; | 0 | ||||||||||||||||||
| 609 | - | |||||||||||||||||||
| 610 | case QOpenGLTexture::RG16F: never executed: case QOpenGLTexture::RG16F: | 0 | ||||||||||||||||||
| 611 | return QOpenGLTexture::RG; never executed: return QOpenGLTexture::RG; | 0 | ||||||||||||||||||
| 612 | - | |||||||||||||||||||
| 613 | case QOpenGLTexture::RGB16F: never executed: case QOpenGLTexture::RGB16F: | 0 | ||||||||||||||||||
| 614 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 615 | - | |||||||||||||||||||
| 616 | case QOpenGLTexture::RGBA16F: never executed: case QOpenGLTexture::RGBA16F: | 0 | ||||||||||||||||||
| 617 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 618 | - | |||||||||||||||||||
| 619 | case QOpenGLTexture::R32F: never executed: case QOpenGLTexture::R32F: | 0 | ||||||||||||||||||
| 620 | return QOpenGLTexture::Red; never executed: return QOpenGLTexture::Red; | 0 | ||||||||||||||||||
| 621 | - | |||||||||||||||||||
| 622 | case QOpenGLTexture::RG32F: never executed: case QOpenGLTexture::RG32F: | 0 | ||||||||||||||||||
| 623 | return QOpenGLTexture::RG; never executed: return QOpenGLTexture::RG; | 0 | ||||||||||||||||||
| 624 | - | |||||||||||||||||||
| 625 | case QOpenGLTexture::RGB32F: never executed: case QOpenGLTexture::RGB32F: | 0 | ||||||||||||||||||
| 626 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 627 | - | |||||||||||||||||||
| 628 | case QOpenGLTexture::RGBA32F: never executed: case QOpenGLTexture::RGBA32F: | 0 | ||||||||||||||||||
| 629 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 630 | - | |||||||||||||||||||
| 631 | case QOpenGLTexture::RGB9E5: never executed: case QOpenGLTexture::RGB9E5: | 0 | ||||||||||||||||||
| 632 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 633 | - | |||||||||||||||||||
| 634 | case QOpenGLTexture::RG11B10F: never executed: case QOpenGLTexture::RG11B10F: | 0 | ||||||||||||||||||
| 635 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 636 | - | |||||||||||||||||||
| 637 | case QOpenGLTexture::RG3B2: never executed: case QOpenGLTexture::RG3B2: | 0 | ||||||||||||||||||
| 638 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 639 | - | |||||||||||||||||||
| 640 | case QOpenGLTexture::R5G6B5: never executed: case QOpenGLTexture::R5G6B5: | 0 | ||||||||||||||||||
| 641 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 642 | - | |||||||||||||||||||
| 643 | case QOpenGLTexture::RGB5A1: never executed: case QOpenGLTexture::RGB5A1: | 0 | ||||||||||||||||||
| 644 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 645 | - | |||||||||||||||||||
| 646 | case QOpenGLTexture::RGBA4: never executed: case QOpenGLTexture::RGBA4: | 0 | ||||||||||||||||||
| 647 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 648 | - | |||||||||||||||||||
| 649 | case QOpenGLTexture::RGB10A2: never executed: case QOpenGLTexture::RGB10A2: | 0 | ||||||||||||||||||
| 650 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 651 | - | |||||||||||||||||||
| 652 | case QOpenGLTexture::D16: never executed: case QOpenGLTexture::D16: | 0 | ||||||||||||||||||
| 653 | case QOpenGLTexture::D24: never executed: case QOpenGLTexture::D24: | 0 | ||||||||||||||||||
| 654 | case QOpenGLTexture::D32: never executed: case QOpenGLTexture::D32: | 0 | ||||||||||||||||||
| 655 | case QOpenGLTexture::D32F: never executed: case QOpenGLTexture::D32F: | 0 | ||||||||||||||||||
| 656 | return QOpenGLTexture::Depth; never executed: return QOpenGLTexture::Depth; | 0 | ||||||||||||||||||
| 657 | - | |||||||||||||||||||
| 658 | case QOpenGLTexture::D24S8: never executed: case QOpenGLTexture::D24S8: | 0 | ||||||||||||||||||
| 659 | case QOpenGLTexture::D32FS8X24: never executed: case QOpenGLTexture::D32FS8X24: | 0 | ||||||||||||||||||
| 660 | return QOpenGLTexture::DepthStencil; never executed: return QOpenGLTexture::DepthStencil; | 0 | ||||||||||||||||||
| 661 | - | |||||||||||||||||||
| 662 | case QOpenGLTexture::S8: never executed: case QOpenGLTexture::S8: | 0 | ||||||||||||||||||
| 663 | return QOpenGLTexture::Stencil; never executed: return QOpenGLTexture::Stencil; | 0 | ||||||||||||||||||
| 664 | - | |||||||||||||||||||
| 665 | case QOpenGLTexture::RGB_DXT1: never executed: case QOpenGLTexture::RGB_DXT1: | 0 | ||||||||||||||||||
| 666 | case QOpenGLTexture::RGBA_DXT1: never executed: case QOpenGLTexture::RGBA_DXT1: | 0 | ||||||||||||||||||
| 667 | case QOpenGLTexture::RGBA_DXT3: never executed: case QOpenGLTexture::RGBA_DXT3: | 0 | ||||||||||||||||||
| 668 | case QOpenGLTexture::RGBA_DXT5: never executed: case QOpenGLTexture::RGBA_DXT5: | 0 | ||||||||||||||||||
| 669 | case QOpenGLTexture::R_ATI1N_UNorm: never executed: case QOpenGLTexture::R_ATI1N_UNorm: | 0 | ||||||||||||||||||
| 670 | case QOpenGLTexture::R_ATI1N_SNorm: never executed: case QOpenGLTexture::R_ATI1N_SNorm: | 0 | ||||||||||||||||||
| 671 | case QOpenGLTexture::RG_ATI2N_UNorm: never executed: case QOpenGLTexture::RG_ATI2N_UNorm: | 0 | ||||||||||||||||||
| 672 | case QOpenGLTexture::RG_ATI2N_SNorm: never executed: case QOpenGLTexture::RG_ATI2N_SNorm: | 0 | ||||||||||||||||||
| 673 | case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT: never executed: case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT: | 0 | ||||||||||||||||||
| 674 | case QOpenGLTexture::RGB_BP_SIGNED_FLOAT: never executed: case QOpenGLTexture::RGB_BP_SIGNED_FLOAT: | 0 | ||||||||||||||||||
| 675 | case QOpenGLTexture::RGB_BP_UNorm: never executed: case QOpenGLTexture::RGB_BP_UNorm: | 0 | ||||||||||||||||||
| 676 | case QOpenGLTexture::SRGB8: never executed: case QOpenGLTexture::SRGB8: | 0 | ||||||||||||||||||
| 677 | case QOpenGLTexture::SRGB8_Alpha8: never executed: case QOpenGLTexture::SRGB8_Alpha8: | 0 | ||||||||||||||||||
| 678 | case QOpenGLTexture::SRGB_DXT1: never executed: case QOpenGLTexture::SRGB_DXT1: | 0 | ||||||||||||||||||
| 679 | case QOpenGLTexture::SRGB_Alpha_DXT1: never executed: case QOpenGLTexture::SRGB_Alpha_DXT1: | 0 | ||||||||||||||||||
| 680 | case QOpenGLTexture::SRGB_Alpha_DXT3: never executed: case QOpenGLTexture::SRGB_Alpha_DXT3: | 0 | ||||||||||||||||||
| 681 | case QOpenGLTexture::SRGB_Alpha_DXT5: never executed: case QOpenGLTexture::SRGB_Alpha_DXT5: | 0 | ||||||||||||||||||
| 682 | case QOpenGLTexture::SRGB_BP_UNorm: never executed: case QOpenGLTexture::SRGB_BP_UNorm: | 0 | ||||||||||||||||||
| 683 | case QOpenGLTexture::RGB8_ETC1: never executed: case QOpenGLTexture::RGB8_ETC1: | 0 | ||||||||||||||||||
| 684 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 685 | - | |||||||||||||||||||
| 686 | case QOpenGLTexture::R11_EAC_UNorm: never executed: case QOpenGLTexture::R11_EAC_UNorm: | 0 | ||||||||||||||||||
| 687 | case QOpenGLTexture::R11_EAC_SNorm: never executed: case QOpenGLTexture::R11_EAC_SNorm: | 0 | ||||||||||||||||||
| 688 | return QOpenGLTexture::Red; never executed: return QOpenGLTexture::Red; | 0 | ||||||||||||||||||
| 689 | - | |||||||||||||||||||
| 690 | case QOpenGLTexture::RG11_EAC_UNorm: never executed: case QOpenGLTexture::RG11_EAC_UNorm: | 0 | ||||||||||||||||||
| 691 | case QOpenGLTexture::RG11_EAC_SNorm: never executed: case QOpenGLTexture::RG11_EAC_SNorm: | 0 | ||||||||||||||||||
| 692 | return QOpenGLTexture::RG; never executed: return QOpenGLTexture::RG; | 0 | ||||||||||||||||||
| 693 | - | |||||||||||||||||||
| 694 | case QOpenGLTexture::RGB8_ETC2: never executed: case QOpenGLTexture::RGB8_ETC2: | 0 | ||||||||||||||||||
| 695 | case QOpenGLTexture::SRGB8_ETC2: never executed: case QOpenGLTexture::SRGB8_ETC2: | 0 | ||||||||||||||||||
| 696 | return QOpenGLTexture::RGB; never executed: return QOpenGLTexture::RGB; | 0 | ||||||||||||||||||
| 697 | - | |||||||||||||||||||
| 698 | case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 699 | case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 700 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 701 | - | |||||||||||||||||||
| 702 | case QOpenGLTexture::RGBA8_ETC2_EAC: never executed: case QOpenGLTexture::RGBA8_ETC2_EAC: | 0 | ||||||||||||||||||
| 703 | case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: never executed: case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: | 0 | ||||||||||||||||||
| 704 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 705 | - | |||||||||||||||||||
| 706 | case QOpenGLTexture::DepthFormat: never executed: case QOpenGLTexture::DepthFormat: | 0 | ||||||||||||||||||
| 707 | return QOpenGLTexture::Depth; never executed: return QOpenGLTexture::Depth; | 0 | ||||||||||||||||||
| 708 | - | |||||||||||||||||||
| 709 | case QOpenGLTexture::AlphaFormat: never executed: case QOpenGLTexture::AlphaFormat: | 0 | ||||||||||||||||||
| 710 | return QOpenGLTexture::Alpha; never executed: return QOpenGLTexture::Alpha; | 0 | ||||||||||||||||||
| 711 | - | |||||||||||||||||||
| 712 | case QOpenGLTexture::RGBFormat: never executed: case QOpenGLTexture::RGBFormat: | 0 | ||||||||||||||||||
| 713 | case QOpenGLTexture::RGBAFormat: never executed: case QOpenGLTexture::RGBAFormat: | 0 | ||||||||||||||||||
| 714 | return QOpenGLTexture::RGBA; never executed: return QOpenGLTexture::RGBA; | 0 | ||||||||||||||||||
| 715 | - | |||||||||||||||||||
| 716 | case QOpenGLTexture::LuminanceFormat: never executed: case QOpenGLTexture::LuminanceFormat: | 0 | ||||||||||||||||||
| 717 | return QOpenGLTexture::Luminance; never executed: return QOpenGLTexture::Luminance; | 0 | ||||||||||||||||||
| 718 | - | |||||||||||||||||||
| 719 | case QOpenGLTexture::LuminanceAlphaFormat: never executed: case QOpenGLTexture::LuminanceAlphaFormat: | 0 | ||||||||||||||||||
| 720 | return QOpenGLTexture::LuminanceAlpha; never executed: return QOpenGLTexture::LuminanceAlpha; | 0 | ||||||||||||||||||
| 721 | } | - | ||||||||||||||||||
| 722 | - | |||||||||||||||||||
| 723 | Q_UNREACHABLE(); | - | ||||||||||||||||||
| 724 | return QOpenGLTexture::NoSourceFormat; never executed: return QOpenGLTexture::NoSourceFormat; | 0 | ||||||||||||||||||
| 725 | } | - | ||||||||||||||||||
| 726 | - | |||||||||||||||||||
| 727 | static QOpenGLTexture::PixelType pixelTypeCompatibleWithInternalFormat(QOpenGLTexture::TextureFormat internalFormat) | - | ||||||||||||||||||
| 728 | { | - | ||||||||||||||||||
| 729 | switch (internalFormat) { | - | ||||||||||||||||||
| 730 | case QOpenGLTexture::NoFormat: never executed: case QOpenGLTexture::NoFormat: | 0 | ||||||||||||||||||
| 731 | return QOpenGLTexture::NoPixelType; never executed: return QOpenGLTexture::NoPixelType; | 0 | ||||||||||||||||||
| 732 | - | |||||||||||||||||||
| 733 | case QOpenGLTexture::R8_UNorm: never executed: case QOpenGLTexture::R8_UNorm: | 0 | ||||||||||||||||||
| 734 | case QOpenGLTexture::RG8_UNorm: never executed: case QOpenGLTexture::RG8_UNorm: | 0 | ||||||||||||||||||
| 735 | case QOpenGLTexture::RGB8_UNorm: never executed: case QOpenGLTexture::RGB8_UNorm: | 0 | ||||||||||||||||||
| 736 | case QOpenGLTexture::RGBA8_UNorm: never executed: case QOpenGLTexture::RGBA8_UNorm: | 0 | ||||||||||||||||||
| 737 | case QOpenGLTexture::R16_UNorm: never executed: case QOpenGLTexture::R16_UNorm: | 0 | ||||||||||||||||||
| 738 | case QOpenGLTexture::RG16_UNorm: never executed: case QOpenGLTexture::RG16_UNorm: | 0 | ||||||||||||||||||
| 739 | case QOpenGLTexture::RGB16_UNorm: never executed: case QOpenGLTexture::RGB16_UNorm: | 0 | ||||||||||||||||||
| 740 | case QOpenGLTexture::RGBA16_UNorm: never executed: case QOpenGLTexture::RGBA16_UNorm: | 0 | ||||||||||||||||||
| 741 | return QOpenGLTexture::UInt8; never executed: return QOpenGLTexture::UInt8; | 0 | ||||||||||||||||||
| 742 | - | |||||||||||||||||||
| 743 | case QOpenGLTexture::R8_SNorm: never executed: case QOpenGLTexture::R8_SNorm: | 0 | ||||||||||||||||||
| 744 | case QOpenGLTexture::RG8_SNorm: never executed: case QOpenGLTexture::RG8_SNorm: | 0 | ||||||||||||||||||
| 745 | case QOpenGLTexture::RGB8_SNorm: never executed: case QOpenGLTexture::RGB8_SNorm: | 0 | ||||||||||||||||||
| 746 | case QOpenGLTexture::RGBA8_SNorm: never executed: case QOpenGLTexture::RGBA8_SNorm: | 0 | ||||||||||||||||||
| 747 | case QOpenGLTexture::R16_SNorm: never executed: case QOpenGLTexture::R16_SNorm: | 0 | ||||||||||||||||||
| 748 | case QOpenGLTexture::RG16_SNorm: never executed: case QOpenGLTexture::RG16_SNorm: | 0 | ||||||||||||||||||
| 749 | case QOpenGLTexture::RGB16_SNorm: never executed: case QOpenGLTexture::RGB16_SNorm: | 0 | ||||||||||||||||||
| 750 | case QOpenGLTexture::RGBA16_SNorm: never executed: case QOpenGLTexture::RGBA16_SNorm: | 0 | ||||||||||||||||||
| 751 | return QOpenGLTexture::Int8; never executed: return QOpenGLTexture::Int8; | 0 | ||||||||||||||||||
| 752 | - | |||||||||||||||||||
| 753 | case QOpenGLTexture::R8U: never executed: case QOpenGLTexture::R8U: | 0 | ||||||||||||||||||
| 754 | case QOpenGLTexture::RG8U: never executed: case QOpenGLTexture::RG8U: | 0 | ||||||||||||||||||
| 755 | case QOpenGLTexture::RGB8U: never executed: case QOpenGLTexture::RGB8U: | 0 | ||||||||||||||||||
| 756 | case QOpenGLTexture::RGBA8U: never executed: case QOpenGLTexture::RGBA8U: | 0 | ||||||||||||||||||
| 757 | case QOpenGLTexture::R16U: never executed: case QOpenGLTexture::R16U: | 0 | ||||||||||||||||||
| 758 | case QOpenGLTexture::RG16U: never executed: case QOpenGLTexture::RG16U: | 0 | ||||||||||||||||||
| 759 | case QOpenGLTexture::RGB16U: never executed: case QOpenGLTexture::RGB16U: | 0 | ||||||||||||||||||
| 760 | case QOpenGLTexture::RGBA16U: never executed: case QOpenGLTexture::RGBA16U: | 0 | ||||||||||||||||||
| 761 | case QOpenGLTexture::R32U: never executed: case QOpenGLTexture::R32U: | 0 | ||||||||||||||||||
| 762 | case QOpenGLTexture::RG32U: never executed: case QOpenGLTexture::RG32U: | 0 | ||||||||||||||||||
| 763 | case QOpenGLTexture::RGB32U: never executed: case QOpenGLTexture::RGB32U: | 0 | ||||||||||||||||||
| 764 | case QOpenGLTexture::RGBA32U: never executed: case QOpenGLTexture::RGBA32U: | 0 | ||||||||||||||||||
| 765 | return QOpenGLTexture::UInt8; never executed: return QOpenGLTexture::UInt8; | 0 | ||||||||||||||||||
| 766 | - | |||||||||||||||||||
| 767 | case QOpenGLTexture::R8I: never executed: case QOpenGLTexture::R8I: | 0 | ||||||||||||||||||
| 768 | case QOpenGLTexture::RG8I: never executed: case QOpenGLTexture::RG8I: | 0 | ||||||||||||||||||
| 769 | case QOpenGLTexture::RGB8I: never executed: case QOpenGLTexture::RGB8I: | 0 | ||||||||||||||||||
| 770 | case QOpenGLTexture::RGBA8I: never executed: case QOpenGLTexture::RGBA8I: | 0 | ||||||||||||||||||
| 771 | case QOpenGLTexture::R16I: never executed: case QOpenGLTexture::R16I: | 0 | ||||||||||||||||||
| 772 | case QOpenGLTexture::RG16I: never executed: case QOpenGLTexture::RG16I: | 0 | ||||||||||||||||||
| 773 | case QOpenGLTexture::RGB16I: never executed: case QOpenGLTexture::RGB16I: | 0 | ||||||||||||||||||
| 774 | case QOpenGLTexture::RGBA16I: never executed: case QOpenGLTexture::RGBA16I: | 0 | ||||||||||||||||||
| 775 | case QOpenGLTexture::R32I: never executed: case QOpenGLTexture::R32I: | 0 | ||||||||||||||||||
| 776 | case QOpenGLTexture::RG32I: never executed: case QOpenGLTexture::RG32I: | 0 | ||||||||||||||||||
| 777 | case QOpenGLTexture::RGB32I: never executed: case QOpenGLTexture::RGB32I: | 0 | ||||||||||||||||||
| 778 | case QOpenGLTexture::RGBA32I: never executed: case QOpenGLTexture::RGBA32I: | 0 | ||||||||||||||||||
| 779 | return QOpenGLTexture::Int8; never executed: return QOpenGLTexture::Int8; | 0 | ||||||||||||||||||
| 780 | - | |||||||||||||||||||
| 781 | case QOpenGLTexture::R16F: never executed: case QOpenGLTexture::R16F: | 0 | ||||||||||||||||||
| 782 | case QOpenGLTexture::RG16F: never executed: case QOpenGLTexture::RG16F: | 0 | ||||||||||||||||||
| 783 | case QOpenGLTexture::RGB16F: never executed: case QOpenGLTexture::RGB16F: | 0 | ||||||||||||||||||
| 784 | case QOpenGLTexture::RGBA16F: never executed: case QOpenGLTexture::RGBA16F: | 0 | ||||||||||||||||||
| 785 | return QOpenGLTexture::Float16; never executed: return QOpenGLTexture::Float16; | 0 | ||||||||||||||||||
| 786 | - | |||||||||||||||||||
| 787 | case QOpenGLTexture::R32F: never executed: case QOpenGLTexture::R32F: | 0 | ||||||||||||||||||
| 788 | case QOpenGLTexture::RG32F: never executed: case QOpenGLTexture::RG32F: | 0 | ||||||||||||||||||
| 789 | case QOpenGLTexture::RGB32F: never executed: case QOpenGLTexture::RGB32F: | 0 | ||||||||||||||||||
| 790 | case QOpenGLTexture::RGBA32F: never executed: case QOpenGLTexture::RGBA32F: | 0 | ||||||||||||||||||
| 791 | return QOpenGLTexture::Float32; never executed: return QOpenGLTexture::Float32; | 0 | ||||||||||||||||||
| 792 | - | |||||||||||||||||||
| 793 | case QOpenGLTexture::RGB9E5: never executed: case QOpenGLTexture::RGB9E5: | 0 | ||||||||||||||||||
| 794 | return QOpenGLTexture::UInt16_RGB5A1_Rev; never executed: return QOpenGLTexture::UInt16_RGB5A1_Rev; | 0 | ||||||||||||||||||
| 795 | - | |||||||||||||||||||
| 796 | case QOpenGLTexture::RG11B10F: never executed: case QOpenGLTexture::RG11B10F: | 0 | ||||||||||||||||||
| 797 | return QOpenGLTexture::UInt32_RG11B10F; never executed: return QOpenGLTexture::UInt32_RG11B10F; | 0 | ||||||||||||||||||
| 798 | - | |||||||||||||||||||
| 799 | case QOpenGLTexture::RG3B2: never executed: case QOpenGLTexture::RG3B2: | 0 | ||||||||||||||||||
| 800 | return QOpenGLTexture::UInt8_RG3B2; never executed: return QOpenGLTexture::UInt8_RG3B2; | 0 | ||||||||||||||||||
| 801 | - | |||||||||||||||||||
| 802 | case QOpenGLTexture::R5G6B5: never executed: case QOpenGLTexture::R5G6B5: | 0 | ||||||||||||||||||
| 803 | return QOpenGLTexture::UInt16_R5G6B5; never executed: return QOpenGLTexture::UInt16_R5G6B5; | 0 | ||||||||||||||||||
| 804 | - | |||||||||||||||||||
| 805 | case QOpenGLTexture::RGB5A1: never executed: case QOpenGLTexture::RGB5A1: | 0 | ||||||||||||||||||
| 806 | return QOpenGLTexture::UInt16_RGB5A1; never executed: return QOpenGLTexture::UInt16_RGB5A1; | 0 | ||||||||||||||||||
| 807 | - | |||||||||||||||||||
| 808 | case QOpenGLTexture::RGBA4: never executed: case QOpenGLTexture::RGBA4: | 0 | ||||||||||||||||||
| 809 | return QOpenGLTexture::UInt16_RGBA4; never executed: return QOpenGLTexture::UInt16_RGBA4; | 0 | ||||||||||||||||||
| 810 | - | |||||||||||||||||||
| 811 | case QOpenGLTexture::RGB10A2: never executed: case QOpenGLTexture::RGB10A2: | 0 | ||||||||||||||||||
| 812 | return QOpenGLTexture::UInt32_RGB10A2; never executed: return QOpenGLTexture::UInt32_RGB10A2; | 0 | ||||||||||||||||||
| 813 | - | |||||||||||||||||||
| 814 | case QOpenGLTexture::D16: never executed: case QOpenGLTexture::D16: | 0 | ||||||||||||||||||
| 815 | return QOpenGLTexture::UInt16; never executed: return QOpenGLTexture::UInt16; | 0 | ||||||||||||||||||
| 816 | - | |||||||||||||||||||
| 817 | case QOpenGLTexture::D24: never executed: case QOpenGLTexture::D24: | 0 | ||||||||||||||||||
| 818 | case QOpenGLTexture::D32: never executed: case QOpenGLTexture::D32: | 0 | ||||||||||||||||||
| 819 | return QOpenGLTexture::UInt32; never executed: return QOpenGLTexture::UInt32; | 0 | ||||||||||||||||||
| 820 | - | |||||||||||||||||||
| 821 | case QOpenGLTexture::D32F: never executed: case QOpenGLTexture::D32F: | 0 | ||||||||||||||||||
| 822 | return QOpenGLTexture::Float32; never executed: return QOpenGLTexture::Float32; | 0 | ||||||||||||||||||
| 823 | - | |||||||||||||||||||
| 824 | case QOpenGLTexture::D24S8: never executed: case QOpenGLTexture::D24S8: | 0 | ||||||||||||||||||
| 825 | return QOpenGLTexture::UInt32_D24S8; never executed: return QOpenGLTexture::UInt32_D24S8; | 0 | ||||||||||||||||||
| 826 | - | |||||||||||||||||||
| 827 | case QOpenGLTexture::D32FS8X24: never executed: case QOpenGLTexture::D32FS8X24: | 0 | ||||||||||||||||||
| 828 | return QOpenGLTexture::Float32_D32_UInt32_S8_X24; never executed: return QOpenGLTexture::Float32_D32_UInt32_S8_X24; | 0 | ||||||||||||||||||
| 829 | - | |||||||||||||||||||
| 830 | case QOpenGLTexture::S8: never executed: case QOpenGLTexture::S8: | 0 | ||||||||||||||||||
| 831 | return QOpenGLTexture::UInt8; never executed: return QOpenGLTexture::UInt8; | 0 | ||||||||||||||||||
| 832 | - | |||||||||||||||||||
| 833 | case QOpenGLTexture::RGB_DXT1: never executed: case QOpenGLTexture::RGB_DXT1: | 0 | ||||||||||||||||||
| 834 | case QOpenGLTexture::RGBA_DXT1: never executed: case QOpenGLTexture::RGBA_DXT1: | 0 | ||||||||||||||||||
| 835 | case QOpenGLTexture::RGBA_DXT3: never executed: case QOpenGLTexture::RGBA_DXT3: | 0 | ||||||||||||||||||
| 836 | case QOpenGLTexture::RGBA_DXT5: never executed: case QOpenGLTexture::RGBA_DXT5: | 0 | ||||||||||||||||||
| 837 | case QOpenGLTexture::R_ATI1N_UNorm: never executed: case QOpenGLTexture::R_ATI1N_UNorm: | 0 | ||||||||||||||||||
| 838 | case QOpenGLTexture::R_ATI1N_SNorm: never executed: case QOpenGLTexture::R_ATI1N_SNorm: | 0 | ||||||||||||||||||
| 839 | case QOpenGLTexture::RG_ATI2N_UNorm: never executed: case QOpenGLTexture::RG_ATI2N_UNorm: | 0 | ||||||||||||||||||
| 840 | case QOpenGLTexture::RG_ATI2N_SNorm: never executed: case QOpenGLTexture::RG_ATI2N_SNorm: | 0 | ||||||||||||||||||
| 841 | case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT: never executed: case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT: | 0 | ||||||||||||||||||
| 842 | case QOpenGLTexture::RGB_BP_SIGNED_FLOAT: never executed: case QOpenGLTexture::RGB_BP_SIGNED_FLOAT: | 0 | ||||||||||||||||||
| 843 | case QOpenGLTexture::RGB_BP_UNorm: never executed: case QOpenGLTexture::RGB_BP_UNorm: | 0 | ||||||||||||||||||
| 844 | case QOpenGLTexture::SRGB8: never executed: case QOpenGLTexture::SRGB8: | 0 | ||||||||||||||||||
| 845 | case QOpenGLTexture::SRGB8_Alpha8: never executed: case QOpenGLTexture::SRGB8_Alpha8: | 0 | ||||||||||||||||||
| 846 | case QOpenGLTexture::SRGB_DXT1: never executed: case QOpenGLTexture::SRGB_DXT1: | 0 | ||||||||||||||||||
| 847 | case QOpenGLTexture::SRGB_Alpha_DXT1: never executed: case QOpenGLTexture::SRGB_Alpha_DXT1: | 0 | ||||||||||||||||||
| 848 | case QOpenGLTexture::SRGB_Alpha_DXT3: never executed: case QOpenGLTexture::SRGB_Alpha_DXT3: | 0 | ||||||||||||||||||
| 849 | case QOpenGLTexture::SRGB_Alpha_DXT5: never executed: case QOpenGLTexture::SRGB_Alpha_DXT5: | 0 | ||||||||||||||||||
| 850 | case QOpenGLTexture::SRGB_BP_UNorm: never executed: case QOpenGLTexture::SRGB_BP_UNorm: | 0 | ||||||||||||||||||
| 851 | case QOpenGLTexture::R11_EAC_UNorm: never executed: case QOpenGLTexture::R11_EAC_UNorm: | 0 | ||||||||||||||||||
| 852 | case QOpenGLTexture::R11_EAC_SNorm: never executed: case QOpenGLTexture::R11_EAC_SNorm: | 0 | ||||||||||||||||||
| 853 | case QOpenGLTexture::RG11_EAC_UNorm: never executed: case QOpenGLTexture::RG11_EAC_UNorm: | 0 | ||||||||||||||||||
| 854 | case QOpenGLTexture::RG11_EAC_SNorm: never executed: case QOpenGLTexture::RG11_EAC_SNorm: | 0 | ||||||||||||||||||
| 855 | case QOpenGLTexture::RGB8_ETC2: never executed: case QOpenGLTexture::RGB8_ETC2: | 0 | ||||||||||||||||||
| 856 | case QOpenGLTexture::SRGB8_ETC2: never executed: case QOpenGLTexture::SRGB8_ETC2: | 0 | ||||||||||||||||||
| 857 | case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 858 | case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 859 | case QOpenGLTexture::RGBA8_ETC2_EAC: never executed: case QOpenGLTexture::RGBA8_ETC2_EAC: | 0 | ||||||||||||||||||
| 860 | case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: never executed: case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: | 0 | ||||||||||||||||||
| 861 | case QOpenGLTexture::RGB8_ETC1: never executed: case QOpenGLTexture::RGB8_ETC1: | 0 | ||||||||||||||||||
| 862 | return QOpenGLTexture::UInt8; never executed: return QOpenGLTexture::UInt8; | 0 | ||||||||||||||||||
| 863 | - | |||||||||||||||||||
| 864 | case QOpenGLTexture::DepthFormat: never executed: case QOpenGLTexture::DepthFormat: | 0 | ||||||||||||||||||
| 865 | return QOpenGLTexture::UInt32; never executed: return QOpenGLTexture::UInt32; | 0 | ||||||||||||||||||
| 866 | - | |||||||||||||||||||
| 867 | case QOpenGLTexture::AlphaFormat: never executed: case QOpenGLTexture::AlphaFormat: | 0 | ||||||||||||||||||
| 868 | case QOpenGLTexture::RGBFormat: never executed: case QOpenGLTexture::RGBFormat: | 0 | ||||||||||||||||||
| 869 | case QOpenGLTexture::RGBAFormat: never executed: case QOpenGLTexture::RGBAFormat: | 0 | ||||||||||||||||||
| 870 | case QOpenGLTexture::LuminanceFormat: never executed: case QOpenGLTexture::LuminanceFormat: | 0 | ||||||||||||||||||
| 871 | case QOpenGLTexture::LuminanceAlphaFormat: never executed: case QOpenGLTexture::LuminanceAlphaFormat: | 0 | ||||||||||||||||||
| 872 | return QOpenGLTexture::UInt8; never executed: return QOpenGLTexture::UInt8; | 0 | ||||||||||||||||||
| 873 | } | - | ||||||||||||||||||
| 874 | - | |||||||||||||||||||
| 875 | Q_UNREACHABLE(); | - | ||||||||||||||||||
| 876 | return QOpenGLTexture::NoPixelType; never executed: return QOpenGLTexture::NoPixelType; | 0 | ||||||||||||||||||
| 877 | } | - | ||||||||||||||||||
| 878 | - | |||||||||||||||||||
| 879 | static bool isCompressedFormat(QOpenGLTexture::TextureFormat internalFormat) | - | ||||||||||||||||||
| 880 | { | - | ||||||||||||||||||
| 881 | switch (internalFormat) { | - | ||||||||||||||||||
| 882 | case QOpenGLTexture::NoFormat: never executed: case QOpenGLTexture::NoFormat: | 0 | ||||||||||||||||||
| 883 | - | |||||||||||||||||||
| 884 | case QOpenGLTexture::R8_UNorm: never executed: case QOpenGLTexture::R8_UNorm: | 0 | ||||||||||||||||||
| 885 | case QOpenGLTexture::RG8_UNorm: never executed: case QOpenGLTexture::RG8_UNorm: | 0 | ||||||||||||||||||
| 886 | case QOpenGLTexture::RGB8_UNorm: never executed: case QOpenGLTexture::RGB8_UNorm: | 0 | ||||||||||||||||||
| 887 | case QOpenGLTexture::RGBA8_UNorm: never executed: case QOpenGLTexture::RGBA8_UNorm: | 0 | ||||||||||||||||||
| 888 | case QOpenGLTexture::R16_UNorm: never executed: case QOpenGLTexture::R16_UNorm: | 0 | ||||||||||||||||||
| 889 | case QOpenGLTexture::RG16_UNorm: never executed: case QOpenGLTexture::RG16_UNorm: | 0 | ||||||||||||||||||
| 890 | case QOpenGLTexture::RGB16_UNorm: never executed: case QOpenGLTexture::RGB16_UNorm: | 0 | ||||||||||||||||||
| 891 | case QOpenGLTexture::RGBA16_UNorm: never executed: case QOpenGLTexture::RGBA16_UNorm: | 0 | ||||||||||||||||||
| 892 | case QOpenGLTexture::R8_SNorm: never executed: case QOpenGLTexture::R8_SNorm: | 0 | ||||||||||||||||||
| 893 | case QOpenGLTexture::RG8_SNorm: never executed: case QOpenGLTexture::RG8_SNorm: | 0 | ||||||||||||||||||
| 894 | case QOpenGLTexture::RGB8_SNorm: never executed: case QOpenGLTexture::RGB8_SNorm: | 0 | ||||||||||||||||||
| 895 | case QOpenGLTexture::RGBA8_SNorm: never executed: case QOpenGLTexture::RGBA8_SNorm: | 0 | ||||||||||||||||||
| 896 | case QOpenGLTexture::R16_SNorm: never executed: case QOpenGLTexture::R16_SNorm: | 0 | ||||||||||||||||||
| 897 | case QOpenGLTexture::RG16_SNorm: never executed: case QOpenGLTexture::RG16_SNorm: | 0 | ||||||||||||||||||
| 898 | case QOpenGLTexture::RGB16_SNorm: never executed: case QOpenGLTexture::RGB16_SNorm: | 0 | ||||||||||||||||||
| 899 | case QOpenGLTexture::RGBA16_SNorm: never executed: case QOpenGLTexture::RGBA16_SNorm: | 0 | ||||||||||||||||||
| 900 | case QOpenGLTexture::R8U: never executed: case QOpenGLTexture::R8U: | 0 | ||||||||||||||||||
| 901 | case QOpenGLTexture::RG8U: never executed: case QOpenGLTexture::RG8U: | 0 | ||||||||||||||||||
| 902 | case QOpenGLTexture::RGB8U: never executed: case QOpenGLTexture::RGB8U: | 0 | ||||||||||||||||||
| 903 | case QOpenGLTexture::RGBA8U: never executed: case QOpenGLTexture::RGBA8U: | 0 | ||||||||||||||||||
| 904 | case QOpenGLTexture::R16U: never executed: case QOpenGLTexture::R16U: | 0 | ||||||||||||||||||
| 905 | case QOpenGLTexture::RG16U: never executed: case QOpenGLTexture::RG16U: | 0 | ||||||||||||||||||
| 906 | case QOpenGLTexture::RGB16U: never executed: case QOpenGLTexture::RGB16U: | 0 | ||||||||||||||||||
| 907 | case QOpenGLTexture::RGBA16U: never executed: case QOpenGLTexture::RGBA16U: | 0 | ||||||||||||||||||
| 908 | case QOpenGLTexture::R32U: never executed: case QOpenGLTexture::R32U: | 0 | ||||||||||||||||||
| 909 | case QOpenGLTexture::RG32U: never executed: case QOpenGLTexture::RG32U: | 0 | ||||||||||||||||||
| 910 | case QOpenGLTexture::RGB32U: never executed: case QOpenGLTexture::RGB32U: | 0 | ||||||||||||||||||
| 911 | case QOpenGLTexture::RGBA32U: never executed: case QOpenGLTexture::RGBA32U: | 0 | ||||||||||||||||||
| 912 | case QOpenGLTexture::R8I: never executed: case QOpenGLTexture::R8I: | 0 | ||||||||||||||||||
| 913 | case QOpenGLTexture::RG8I: never executed: case QOpenGLTexture::RG8I: | 0 | ||||||||||||||||||
| 914 | case QOpenGLTexture::RGB8I: never executed: case QOpenGLTexture::RGB8I: | 0 | ||||||||||||||||||
| 915 | case QOpenGLTexture::RGBA8I: never executed: case QOpenGLTexture::RGBA8I: | 0 | ||||||||||||||||||
| 916 | case QOpenGLTexture::R16I: never executed: case QOpenGLTexture::R16I: | 0 | ||||||||||||||||||
| 917 | case QOpenGLTexture::RG16I: never executed: case QOpenGLTexture::RG16I: | 0 | ||||||||||||||||||
| 918 | case QOpenGLTexture::RGB16I: never executed: case QOpenGLTexture::RGB16I: | 0 | ||||||||||||||||||
| 919 | case QOpenGLTexture::RGBA16I: never executed: case QOpenGLTexture::RGBA16I: | 0 | ||||||||||||||||||
| 920 | case QOpenGLTexture::R32I: never executed: case QOpenGLTexture::R32I: | 0 | ||||||||||||||||||
| 921 | case QOpenGLTexture::RG32I: never executed: case QOpenGLTexture::RG32I: | 0 | ||||||||||||||||||
| 922 | case QOpenGLTexture::RGB32I: never executed: case QOpenGLTexture::RGB32I: | 0 | ||||||||||||||||||
| 923 | case QOpenGLTexture::RGBA32I: never executed: case QOpenGLTexture::RGBA32I: | 0 | ||||||||||||||||||
| 924 | case QOpenGLTexture::R16F: never executed: case QOpenGLTexture::R16F: | 0 | ||||||||||||||||||
| 925 | case QOpenGLTexture::RG16F: never executed: case QOpenGLTexture::RG16F: | 0 | ||||||||||||||||||
| 926 | case QOpenGLTexture::RGB16F: never executed: case QOpenGLTexture::RGB16F: | 0 | ||||||||||||||||||
| 927 | case QOpenGLTexture::RGBA16F: never executed: case QOpenGLTexture::RGBA16F: | 0 | ||||||||||||||||||
| 928 | case QOpenGLTexture::R32F: never executed: case QOpenGLTexture::R32F: | 0 | ||||||||||||||||||
| 929 | case QOpenGLTexture::RG32F: never executed: case QOpenGLTexture::RG32F: | 0 | ||||||||||||||||||
| 930 | case QOpenGLTexture::RGB32F: never executed: case QOpenGLTexture::RGB32F: | 0 | ||||||||||||||||||
| 931 | case QOpenGLTexture::RGBA32F: never executed: case QOpenGLTexture::RGBA32F: | 0 | ||||||||||||||||||
| 932 | case QOpenGLTexture::RGB9E5: never executed: case QOpenGLTexture::RGB9E5: | 0 | ||||||||||||||||||
| 933 | case QOpenGLTexture::RG11B10F: never executed: case QOpenGLTexture::RG11B10F: | 0 | ||||||||||||||||||
| 934 | case QOpenGLTexture::RG3B2: never executed: case QOpenGLTexture::RG3B2: | 0 | ||||||||||||||||||
| 935 | case QOpenGLTexture::R5G6B5: never executed: case QOpenGLTexture::R5G6B5: | 0 | ||||||||||||||||||
| 936 | case QOpenGLTexture::RGB5A1: never executed: case QOpenGLTexture::RGB5A1: | 0 | ||||||||||||||||||
| 937 | case QOpenGLTexture::RGBA4: never executed: case QOpenGLTexture::RGBA4: | 0 | ||||||||||||||||||
| 938 | case QOpenGLTexture::RGB10A2: never executed: case QOpenGLTexture::RGB10A2: | 0 | ||||||||||||||||||
| 939 | - | |||||||||||||||||||
| 940 | case QOpenGLTexture::D16: never executed: case QOpenGLTexture::D16: | 0 | ||||||||||||||||||
| 941 | case QOpenGLTexture::D24: never executed: case QOpenGLTexture::D24: | 0 | ||||||||||||||||||
| 942 | case QOpenGLTexture::D32: never executed: case QOpenGLTexture::D32: | 0 | ||||||||||||||||||
| 943 | case QOpenGLTexture::D32F: never executed: case QOpenGLTexture::D32F: | 0 | ||||||||||||||||||
| 944 | - | |||||||||||||||||||
| 945 | case QOpenGLTexture::D24S8: never executed: case QOpenGLTexture::D24S8: | 0 | ||||||||||||||||||
| 946 | case QOpenGLTexture::D32FS8X24: never executed: case QOpenGLTexture::D32FS8X24: | 0 | ||||||||||||||||||
| 947 | - | |||||||||||||||||||
| 948 | case QOpenGLTexture::S8: never executed: case QOpenGLTexture::S8: | 0 | ||||||||||||||||||
| 949 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 950 | - | |||||||||||||||||||
| 951 | case QOpenGLTexture::RGB_DXT1: never executed: case QOpenGLTexture::RGB_DXT1: | 0 | ||||||||||||||||||
| 952 | case QOpenGLTexture::RGBA_DXT1: never executed: case QOpenGLTexture::RGBA_DXT1: | 0 | ||||||||||||||||||
| 953 | case QOpenGLTexture::RGBA_DXT3: never executed: case QOpenGLTexture::RGBA_DXT3: | 0 | ||||||||||||||||||
| 954 | case QOpenGLTexture::RGBA_DXT5: never executed: case QOpenGLTexture::RGBA_DXT5: | 0 | ||||||||||||||||||
| 955 | case QOpenGLTexture::R_ATI1N_UNorm: never executed: case QOpenGLTexture::R_ATI1N_UNorm: | 0 | ||||||||||||||||||
| 956 | case QOpenGLTexture::R_ATI1N_SNorm: never executed: case QOpenGLTexture::R_ATI1N_SNorm: | 0 | ||||||||||||||||||
| 957 | case QOpenGLTexture::RG_ATI2N_UNorm: never executed: case QOpenGLTexture::RG_ATI2N_UNorm: | 0 | ||||||||||||||||||
| 958 | case QOpenGLTexture::RG_ATI2N_SNorm: never executed: case QOpenGLTexture::RG_ATI2N_SNorm: | 0 | ||||||||||||||||||
| 959 | case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT: never executed: case QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT: | 0 | ||||||||||||||||||
| 960 | case QOpenGLTexture::RGB_BP_SIGNED_FLOAT: never executed: case QOpenGLTexture::RGB_BP_SIGNED_FLOAT: | 0 | ||||||||||||||||||
| 961 | case QOpenGLTexture::RGB_BP_UNorm: never executed: case QOpenGLTexture::RGB_BP_UNorm: | 0 | ||||||||||||||||||
| 962 | case QOpenGLTexture::SRGB8: never executed: case QOpenGLTexture::SRGB8: | 0 | ||||||||||||||||||
| 963 | case QOpenGLTexture::SRGB8_Alpha8: never executed: case QOpenGLTexture::SRGB8_Alpha8: | 0 | ||||||||||||||||||
| 964 | case QOpenGLTexture::SRGB_DXT1: never executed: case QOpenGLTexture::SRGB_DXT1: | 0 | ||||||||||||||||||
| 965 | case QOpenGLTexture::SRGB_Alpha_DXT1: never executed: case QOpenGLTexture::SRGB_Alpha_DXT1: | 0 | ||||||||||||||||||
| 966 | case QOpenGLTexture::SRGB_Alpha_DXT3: never executed: case QOpenGLTexture::SRGB_Alpha_DXT3: | 0 | ||||||||||||||||||
| 967 | case QOpenGLTexture::SRGB_Alpha_DXT5: never executed: case QOpenGLTexture::SRGB_Alpha_DXT5: | 0 | ||||||||||||||||||
| 968 | case QOpenGLTexture::SRGB_BP_UNorm: never executed: case QOpenGLTexture::SRGB_BP_UNorm: | 0 | ||||||||||||||||||
| 969 | case QOpenGLTexture::R11_EAC_UNorm: never executed: case QOpenGLTexture::R11_EAC_UNorm: | 0 | ||||||||||||||||||
| 970 | case QOpenGLTexture::R11_EAC_SNorm: never executed: case QOpenGLTexture::R11_EAC_SNorm: | 0 | ||||||||||||||||||
| 971 | case QOpenGLTexture::RG11_EAC_UNorm: never executed: case QOpenGLTexture::RG11_EAC_UNorm: | 0 | ||||||||||||||||||
| 972 | case QOpenGLTexture::RG11_EAC_SNorm: never executed: case QOpenGLTexture::RG11_EAC_SNorm: | 0 | ||||||||||||||||||
| 973 | case QOpenGLTexture::RGB8_ETC2: never executed: case QOpenGLTexture::RGB8_ETC2: | 0 | ||||||||||||||||||
| 974 | case QOpenGLTexture::SRGB8_ETC2: never executed: case QOpenGLTexture::SRGB8_ETC2: | 0 | ||||||||||||||||||
| 975 | case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 976 | case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 977 | case QOpenGLTexture::RGBA8_ETC2_EAC: never executed: case QOpenGLTexture::RGBA8_ETC2_EAC: | 0 | ||||||||||||||||||
| 978 | case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: never executed: case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: | 0 | ||||||||||||||||||
| 979 | case QOpenGLTexture::RGB8_ETC1: never executed: case QOpenGLTexture::RGB8_ETC1: | 0 | ||||||||||||||||||
| 980 | return true; never executed: return true; | 0 | ||||||||||||||||||
| 981 | - | |||||||||||||||||||
| 982 | case QOpenGLTexture::DepthFormat: never executed: case QOpenGLTexture::DepthFormat: | 0 | ||||||||||||||||||
| 983 | case QOpenGLTexture::AlphaFormat: never executed: case QOpenGLTexture::AlphaFormat: | 0 | ||||||||||||||||||
| 984 | case QOpenGLTexture::RGBFormat: never executed: case QOpenGLTexture::RGBFormat: | 0 | ||||||||||||||||||
| 985 | case QOpenGLTexture::RGBAFormat: never executed: case QOpenGLTexture::RGBAFormat: | 0 | ||||||||||||||||||
| 986 | case QOpenGLTexture::LuminanceFormat: never executed: case QOpenGLTexture::LuminanceFormat: | 0 | ||||||||||||||||||
| 987 | case QOpenGLTexture::LuminanceAlphaFormat: never executed: case QOpenGLTexture::LuminanceAlphaFormat: | 0 | ||||||||||||||||||
| 988 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 989 | } | - | ||||||||||||||||||
| 990 | - | |||||||||||||||||||
| 991 | Q_UNREACHABLE(); | - | ||||||||||||||||||
| 992 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 993 | } | - | ||||||||||||||||||
| 994 | - | |||||||||||||||||||
| 995 | void QOpenGLTexturePrivate::allocateMutableStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType) | - | ||||||||||||||||||
| 996 | { | - | ||||||||||||||||||
| 997 | // There is no way to allocate mutable storage for compressed textures in in | - | ||||||||||||||||||
| 998 | // versions older than OpenGL 3.1 and OpenGL ES 3.0, because the older specs | - | ||||||||||||||||||
| 999 | // do not mandate accepting null data pointers for glCompressedTexImage*D, | - | ||||||||||||||||||
| 1000 | // unlike glTexImage*D (which in turn does not accept compressed formats). | - | ||||||||||||||||||
| 1001 | if (isCompressedFormat(format)) {
| 0 | ||||||||||||||||||
| 1002 | storageAllocated = true; | - | ||||||||||||||||||
| 1003 | return; never executed: return; | 0 | ||||||||||||||||||
| 1004 | } | - | ||||||||||||||||||
| 1005 | - | |||||||||||||||||||
| 1006 | switch (target) { | - | ||||||||||||||||||
| 1007 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 1008 | // Buffer textures get their storage from an external OpenGL buffer | - | ||||||||||||||||||
| 1009 | qWarning("Buffer textures do not allocate storage"); | - | ||||||||||||||||||
| 1010 | return; never executed: return; | 0 | ||||||||||||||||||
| 1011 | - | |||||||||||||||||||
| 1012 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 1013 | if (features.testFlag(QOpenGLTexture::Texture1D)) {
| 0 | ||||||||||||||||||
| 1014 | for (int level = 0; level < mipLevels; ++level)
| 0 | ||||||||||||||||||
| 1015 | 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 | ||||||||||||||||||
| 1016 | mipLevelSize(level, dimensions[0]), never executed: texFuncs->glTextureImage1D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1017 | 0, never executed: texFuncs->glTextureImage1D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1018 | pixelFormat, pixelType, 0); never executed: texFuncs->glTextureImage1D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1019 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1020 | qWarning("1D textures are not supported"); | - | ||||||||||||||||||
| 1021 | return; never executed: return; | 0 | ||||||||||||||||||
| 1022 | } | - | ||||||||||||||||||
| 1023 | break; never executed: break; | 0 | ||||||||||||||||||
| 1024 | - | |||||||||||||||||||
| 1025 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 1026 | if (features.testFlag(QOpenGLTexture::Texture1D)
| 0 | ||||||||||||||||||
| 1027 | && features.testFlag(QOpenGLTexture::TextureArrays)) {
| 0 | ||||||||||||||||||
| 1028 | for (int level = 0; level < mipLevels; ++level)
| 0 | ||||||||||||||||||
| 1029 | 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 | ||||||||||||||||||
| 1030 | mipLevelSize(level, dimensions[0]), never executed: texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1031 | layers, never executed: texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1032 | 0, never executed: texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1033 | pixelFormat, pixelType, 0); never executed: texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1034 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1035 | qWarning("1D array textures are not supported"); | - | ||||||||||||||||||
| 1036 | return; never executed: return; | 0 | ||||||||||||||||||
| 1037 | } | - | ||||||||||||||||||
| 1038 | break; never executed: break; | 0 | ||||||||||||||||||
| 1039 | - | |||||||||||||||||||
| 1040 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 1041 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 1042 | for (int level = 0; level < mipLevels; ++level)
| 0 | ||||||||||||||||||
| 1043 | 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 | ||||||||||||||||||
| 1044 | 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 | ||||||||||||||||||
| 1045 | 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 | ||||||||||||||||||
| 1046 | 0, never executed: texFuncs->glTextureImage2D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1047 | 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 | ||||||||||||||||||
| 1048 | break; never executed: break; | 0 | ||||||||||||||||||
| 1049 | - | |||||||||||||||||||
| 1050 | case QOpenGLTexture::TargetCubeMap: { never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 1051 | // Cubemaps are the odd one out. We have to allocate storage for each | - | ||||||||||||||||||
| 1052 | // face and miplevel using the special cubemap face targets rather than | - | ||||||||||||||||||
| 1053 | // GL_TARGET_CUBEMAP. | - | ||||||||||||||||||
| 1054 | const QOpenGLTexture::CubeMapFace faceTargets[] = { | - | ||||||||||||||||||
| 1055 | QOpenGLTexture::CubeMapPositiveX, QOpenGLTexture::CubeMapNegativeX, | - | ||||||||||||||||||
| 1056 | QOpenGLTexture::CubeMapPositiveY, QOpenGLTexture::CubeMapNegativeY, | - | ||||||||||||||||||
| 1057 | QOpenGLTexture::CubeMapPositiveZ, QOpenGLTexture::CubeMapNegativeZ | - | ||||||||||||||||||
| 1058 | }; | - | ||||||||||||||||||
| 1059 | - | |||||||||||||||||||
| 1060 | for (int faceTarget = 0; faceTarget < 6; ++faceTarget) {
| 0 | ||||||||||||||||||
| 1061 | for (int level = 0; level < mipLevels; ++level) {
| 0 | ||||||||||||||||||
| 1062 | texFuncs->glTextureImage2D(textureId, faceTargets[faceTarget], bindingTarget, | - | ||||||||||||||||||
| 1063 | level, format, | - | ||||||||||||||||||
| 1064 | mipLevelSize(level, dimensions[0]), | - | ||||||||||||||||||
| 1065 | mipLevelSize(level, dimensions[1]), | - | ||||||||||||||||||
| 1066 | 0, | - | ||||||||||||||||||
| 1067 | pixelFormat, pixelType, 0); | - | ||||||||||||||||||
| 1068 | } never executed: end of block | 0 | ||||||||||||||||||
| 1069 | } never executed: end of block | 0 | ||||||||||||||||||
| 1070 | break; never executed: break; | 0 | ||||||||||||||||||
| 1071 | } | - | ||||||||||||||||||
| 1072 | - | |||||||||||||||||||
| 1073 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 1074 | if (features.testFlag(QOpenGLTexture::TextureArrays)) {
| 0 | ||||||||||||||||||
| 1075 | for (int level = 0; level < mipLevels; ++level)
| 0 | ||||||||||||||||||
| 1076 | 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 | ||||||||||||||||||
| 1077 | 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 | ||||||||||||||||||
| 1078 | 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 | ||||||||||||||||||
| 1079 | layers, never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1080 | 0, never executed: texFuncs->glTextureImage3D(textureId, target, bindingTarget, level, format, mipLevelSize(level, dimensions[0]), mipLevelSize(level, dimensions[1]), layers, 0, pixelFormat, pixelType, 0); | 0 | ||||||||||||||||||
| 1081 | 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 | ||||||||||||||||||
| 1082 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1083 | qWarning("Array textures are not supported"); | - | ||||||||||||||||||
| 1084 | return; never executed: return; | 0 | ||||||||||||||||||
| 1085 | } | - | ||||||||||||||||||
| 1086 | break; never executed: break; | 0 | ||||||||||||||||||
| 1087 | - | |||||||||||||||||||
| 1088 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 1089 | // Cubemap arrays must specify number of layer-faces (6 * layers) as depth parameter | - | ||||||||||||||||||
| 1090 | if (features.testFlag(QOpenGLTexture::TextureCubeMapArrays)) {
| 0 | ||||||||||||||||||
| 1091 | for (int level = 0; level < mipLevels; ++level)
| 0 | ||||||||||||||||||
| 1092 | 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 | ||||||||||||||||||
| 1093 | 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 | ||||||||||||||||||
| 1094 | 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 | ||||||||||||||||||
| 1095 | 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 | ||||||||||||||||||
| 1096 | 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 | ||||||||||||||||||
| 1097 | 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 | ||||||||||||||||||
| 1098 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1099 | qWarning("Cubemap Array textures are not supported"); | - | ||||||||||||||||||
| 1100 | return; never executed: return; | 0 | ||||||||||||||||||
| 1101 | } | - | ||||||||||||||||||
| 1102 | break; never executed: break; | 0 | ||||||||||||||||||
| 1103 | - | |||||||||||||||||||
| 1104 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 1105 | if (features.testFlag(QOpenGLTexture::Texture3D)) {
| 0 | ||||||||||||||||||
| 1106 | for (int level = 0; level < mipLevels; ++level)
| 0 | ||||||||||||||||||
| 1107 | 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 | ||||||||||||||||||
| 1108 | 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 | ||||||||||||||||||
| 1109 | 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 | ||||||||||||||||||
| 1110 | 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 | ||||||||||||||||||
| 1111 | 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 | ||||||||||||||||||
| 1112 | 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 | ||||||||||||||||||
| 1113 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1114 | qWarning("3D textures are not supported"); | - | ||||||||||||||||||
| 1115 | return; never executed: return; | 0 | ||||||||||||||||||
| 1116 | } | - | ||||||||||||||||||
| 1117 | break; never executed: break; | 0 | ||||||||||||||||||
| 1118 | - | |||||||||||||||||||
| 1119 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 1120 | if (features.testFlag(QOpenGLTexture::TextureMultisample)) {
| 0 | ||||||||||||||||||
| 1121 | texFuncs->glTextureImage2DMultisample(textureId, target, bindingTarget, samples, format, | - | ||||||||||||||||||
| 1122 | dimensions[0], dimensions[1], | - | ||||||||||||||||||
| 1123 | fixedSamplePositions); | - | ||||||||||||||||||
| 1124 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1125 | qWarning("Multisample textures are not supported"); | - | ||||||||||||||||||
| 1126 | return; never executed: return; | 0 | ||||||||||||||||||
| 1127 | } | - | ||||||||||||||||||
| 1128 | break; never executed: break; | 0 | ||||||||||||||||||
| 1129 | - | |||||||||||||||||||
| 1130 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 1131 | if (features.testFlag(QOpenGLTexture::TextureMultisample)
| 0 | ||||||||||||||||||
| 1132 | && features.testFlag(QOpenGLTexture::TextureArrays)) {
| 0 | ||||||||||||||||||
| 1133 | texFuncs->glTextureImage3DMultisample(textureId, target, bindingTarget, samples, format, | - | ||||||||||||||||||
| 1134 | dimensions[0], dimensions[1], layers, | - | ||||||||||||||||||
| 1135 | fixedSamplePositions); | - | ||||||||||||||||||
| 1136 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1137 | qWarning("Multisample array textures are not supported"); | - | ||||||||||||||||||
| 1138 | return; never executed: return; | 0 | ||||||||||||||||||
| 1139 | } | - | ||||||||||||||||||
| 1140 | break; never executed: break; | 0 | ||||||||||||||||||
| 1141 | } | - | ||||||||||||||||||
| 1142 | - | |||||||||||||||||||
| 1143 | storageAllocated = true; | - | ||||||||||||||||||
| 1144 | } never executed: end of block | 0 | ||||||||||||||||||
| 1145 | - | |||||||||||||||||||
| 1146 | void QOpenGLTexturePrivate::allocateImmutableStorage() | - | ||||||||||||||||||
| 1147 | { | - | ||||||||||||||||||
| 1148 | switch (target) { | - | ||||||||||||||||||
| 1149 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 1150 | // Buffer textures get their storage from an external OpenGL buffer | - | ||||||||||||||||||
| 1151 | qWarning("Buffer textures do not allocate storage"); | - | ||||||||||||||||||
| 1152 | return; never executed: return; | 0 | ||||||||||||||||||
| 1153 | - | |||||||||||||||||||
| 1154 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 1155 | if (features.testFlag(QOpenGLTexture::Texture1D)) {
| 0 | ||||||||||||||||||
| 1156 | texFuncs->glTextureStorage1D(textureId, target, bindingTarget, mipLevels, format, | - | ||||||||||||||||||
| 1157 | dimensions[0]); | - | ||||||||||||||||||
| 1158 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1159 | qWarning("1D textures are not supported"); | - | ||||||||||||||||||
| 1160 | return; never executed: return; | 0 | ||||||||||||||||||
| 1161 | } | - | ||||||||||||||||||
| 1162 | break; never executed: break; | 0 | ||||||||||||||||||
| 1163 | - | |||||||||||||||||||
| 1164 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 1165 | if (features.testFlag(QOpenGLTexture::Texture1D)
| 0 | ||||||||||||||||||
| 1166 | && features.testFlag(QOpenGLTexture::TextureArrays)) {
| 0 | ||||||||||||||||||
| 1167 | texFuncs->glTextureStorage2D(textureId, target, bindingTarget, mipLevels, format, | - | ||||||||||||||||||
| 1168 | dimensions[0], layers); | - | ||||||||||||||||||
| 1169 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1170 | qWarning("1D array textures are not supported"); | - | ||||||||||||||||||
| 1171 | return; never executed: return; | 0 | ||||||||||||||||||
| 1172 | } | - | ||||||||||||||||||
| 1173 | break; never executed: break; | 0 | ||||||||||||||||||
| 1174 | - | |||||||||||||||||||
| 1175 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 1176 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 1177 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 1178 | texFuncs->glTextureStorage2D(textureId, target, bindingTarget, mipLevels, format, | - | ||||||||||||||||||
| 1179 | dimensions[0], dimensions[1]); | - | ||||||||||||||||||
| 1180 | break; never executed: break; | 0 | ||||||||||||||||||
| 1181 | - | |||||||||||||||||||
| 1182 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 1183 | if (features.testFlag(QOpenGLTexture::TextureArrays)) {
| 0 | ||||||||||||||||||
| 1184 | texFuncs->glTextureStorage3D(textureId, target, bindingTarget, mipLevels, format, | - | ||||||||||||||||||
| 1185 | dimensions[0], dimensions[1], layers); | - | ||||||||||||||||||
| 1186 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1187 | qWarning("Array textures are not supported"); | - | ||||||||||||||||||
| 1188 | return; never executed: return; | 0 | ||||||||||||||||||
| 1189 | } | - | ||||||||||||||||||
| 1190 | break; never executed: break; | 0 | ||||||||||||||||||
| 1191 | - | |||||||||||||||||||
| 1192 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 1193 | // Cubemap arrays must specify number of layer-faces (6 * layers) as depth parameter | - | ||||||||||||||||||
| 1194 | if (features.testFlag(QOpenGLTexture::TextureCubeMapArrays)) {
| 0 | ||||||||||||||||||
| 1195 | texFuncs->glTextureStorage3D(textureId, target, bindingTarget, mipLevels, format, | - | ||||||||||||||||||
| 1196 | dimensions[0], dimensions[1], 6 * layers); | - | ||||||||||||||||||
| 1197 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1198 | qWarning("Cubemap Array textures are not supported"); | - | ||||||||||||||||||
| 1199 | return; never executed: return; | 0 | ||||||||||||||||||
| 1200 | } | - | ||||||||||||||||||
| 1201 | break; never executed: break; | 0 | ||||||||||||||||||
| 1202 | - | |||||||||||||||||||
| 1203 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 1204 | if (features.testFlag(QOpenGLTexture::Texture3D)) {
| 0 | ||||||||||||||||||
| 1205 | texFuncs->glTextureStorage3D(textureId, target, bindingTarget, mipLevels, format, | - | ||||||||||||||||||
| 1206 | dimensions[0], dimensions[1], dimensions[2]); | - | ||||||||||||||||||
| 1207 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1208 | qWarning("3D textures are not supported"); | - | ||||||||||||||||||
| 1209 | return; never executed: return; | 0 | ||||||||||||||||||
| 1210 | } | - | ||||||||||||||||||
| 1211 | break; never executed: break; | 0 | ||||||||||||||||||
| 1212 | - | |||||||||||||||||||
| 1213 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 1214 | if (features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage)) {
| 0 | ||||||||||||||||||
| 1215 | texFuncs->glTextureStorage2DMultisample(textureId, target, bindingTarget, samples, format, | - | ||||||||||||||||||
| 1216 | dimensions[0], dimensions[1], | - | ||||||||||||||||||
| 1217 | fixedSamplePositions); | - | ||||||||||||||||||
| 1218 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1219 | qWarning("Multisample textures are not supported"); | - | ||||||||||||||||||
| 1220 | return; never executed: return; | 0 | ||||||||||||||||||
| 1221 | } | - | ||||||||||||||||||
| 1222 | break; never executed: break; | 0 | ||||||||||||||||||
| 1223 | - | |||||||||||||||||||
| 1224 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 1225 | if (features.testFlag(QOpenGLTexture::ImmutableMultisampleStorage)
| 0 | ||||||||||||||||||
| 1226 | && features.testFlag(QOpenGLTexture::TextureArrays)) {
| 0 | ||||||||||||||||||
| 1227 | texFuncs->glTextureStorage3DMultisample(textureId, target, bindingTarget, samples, format, | - | ||||||||||||||||||
| 1228 | dimensions[0], dimensions[1], layers, | - | ||||||||||||||||||
| 1229 | fixedSamplePositions); | - | ||||||||||||||||||
| 1230 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1231 | qWarning("Multisample array textures are not supported"); | - | ||||||||||||||||||
| 1232 | return; never executed: return; | 0 | ||||||||||||||||||
| 1233 | } | - | ||||||||||||||||||
| 1234 | break; never executed: break; | 0 | ||||||||||||||||||
| 1235 | } | - | ||||||||||||||||||
| 1236 | - | |||||||||||||||||||
| 1237 | storageAllocated = true; | - | ||||||||||||||||||
| 1238 | } never executed: end of block | 0 | ||||||||||||||||||
| 1239 | - | |||||||||||||||||||
| 1240 | void QOpenGLTexturePrivate::setData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, | - | ||||||||||||||||||
| 1241 | QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, | - | ||||||||||||||||||
| 1242 | const void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 1243 | { | - | ||||||||||||||||||
| 1244 | switch (target) { | - | ||||||||||||||||||
| 1245 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 1246 | Q_UNUSED(layer); | - | ||||||||||||||||||
| 1247 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1248 | texFuncs->glTextureSubImage1D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1249 | 0, mipLevelSize( mipLevel, dimensions[0] ), | - | ||||||||||||||||||
| 1250 | sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 1251 | break; never executed: break; | 0 | ||||||||||||||||||
| 1252 | - | |||||||||||||||||||
| 1253 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 1254 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1255 | texFuncs->glTextureSubImage2D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1256 | 0, layer, | - | ||||||||||||||||||
| 1257 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1258 | 1, | - | ||||||||||||||||||
| 1259 | sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 1260 | break; never executed: break; | 0 | ||||||||||||||||||
| 1261 | - | |||||||||||||||||||
| 1262 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 1263 | Q_UNUSED(layer); | - | ||||||||||||||||||
| 1264 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1265 | texFuncs->glTextureSubImage2D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1266 | 0, 0, | - | ||||||||||||||||||
| 1267 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1268 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1269 | sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 1270 | break; never executed: break; | 0 | ||||||||||||||||||
| 1271 | - | |||||||||||||||||||
| 1272 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 1273 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1274 | texFuncs->glTextureSubImage3D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1275 | 0, 0, layer, | - | ||||||||||||||||||
| 1276 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1277 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1278 | 1, | - | ||||||||||||||||||
| 1279 | sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 1280 | break; never executed: break; | 0 | ||||||||||||||||||
| 1281 | - | |||||||||||||||||||
| 1282 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 1283 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1284 | texFuncs->glTextureSubImage3D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1285 | 0, 0, layer, | - | ||||||||||||||||||
| 1286 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1287 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1288 | mipLevelSize(mipLevel, dimensions[2]), | - | ||||||||||||||||||
| 1289 | sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 1290 | break; never executed: break; | 0 | ||||||||||||||||||
| 1291 | - | |||||||||||||||||||
| 1292 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 1293 | Q_UNUSED(layer); | - | ||||||||||||||||||
| 1294 | texFuncs->glTextureSubImage2D(textureId, cubeFace, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1295 | 0, 0, | - | ||||||||||||||||||
| 1296 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1297 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1298 | sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 1299 | break; never executed: break; | 0 | ||||||||||||||||||
| 1300 | - | |||||||||||||||||||
| 1301 | case QOpenGLTexture::TargetCubeMapArray: { never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 1302 | int faceIndex = cubeFace - QOpenGLTexture::CubeMapPositiveX; | - | ||||||||||||||||||
| 1303 | int layerFace = 6 * layer + faceIndex; | - | ||||||||||||||||||
| 1304 | texFuncs->glTextureSubImage3D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1305 | 0, 0, layerFace, | - | ||||||||||||||||||
| 1306 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1307 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1308 | 1, | - | ||||||||||||||||||
| 1309 | sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 1310 | break; never executed: break; | 0 | ||||||||||||||||||
| 1311 | } | - | ||||||||||||||||||
| 1312 | - | |||||||||||||||||||
| 1313 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 1314 | Q_UNUSED(mipLevel); | - | ||||||||||||||||||
| 1315 | Q_UNUSED(layer); | - | ||||||||||||||||||
| 1316 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1317 | texFuncs->glTextureSubImage2D(textureId, target, bindingTarget, 0, | - | ||||||||||||||||||
| 1318 | 0, 0, | - | ||||||||||||||||||
| 1319 | dimensions[0], | - | ||||||||||||||||||
| 1320 | dimensions[1], | - | ||||||||||||||||||
| 1321 | sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 1322 | break; never executed: break; | 0 | ||||||||||||||||||
| 1323 | - | |||||||||||||||||||
| 1324 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 1325 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 1326 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 1327 | // We don't upload pixel data for these targets | - | ||||||||||||||||||
| 1328 | qWarning("QOpenGLTexture::setData(): Texture target does not support pixel data upload"); | - | ||||||||||||||||||
| 1329 | break; never executed: break; | 0 | ||||||||||||||||||
| 1330 | } | - | ||||||||||||||||||
| 1331 | - | |||||||||||||||||||
| 1332 | // If requested perform automatic mip map generation | - | ||||||||||||||||||
| 1333 | if (mipLevel == 0 && autoGenerateMipMaps && mipLevels > 1) {
| 0 | ||||||||||||||||||
| 1334 | Q_Q(QOpenGLTexture); | - | ||||||||||||||||||
| 1335 | q->generateMipMaps(); | - | ||||||||||||||||||
| 1336 | } never executed: end of block | 0 | ||||||||||||||||||
| 1337 | } never executed: end of block | 0 | ||||||||||||||||||
| 1338 | - | |||||||||||||||||||
| 1339 | void QOpenGLTexturePrivate::setCompressedData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, | - | ||||||||||||||||||
| 1340 | int dataSize, const void *data, | - | ||||||||||||||||||
| 1341 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 1342 | { | - | ||||||||||||||||||
| 1343 | if (!isCompressedFormat(format)) {
| 0 | ||||||||||||||||||
| 1344 | qWarning("Cannot set compressed data for non-compressed format 0x%x", format); | - | ||||||||||||||||||
| 1345 | return; never executed: return; | 0 | ||||||||||||||||||
| 1346 | } | - | ||||||||||||||||||
| 1347 | - | |||||||||||||||||||
| 1348 | const bool needsFullSpec = !isUsingImmutableStorage(); // was allocateStorage() a no-op? | - | ||||||||||||||||||
| 1349 | - | |||||||||||||||||||
| 1350 | switch (target) { | - | ||||||||||||||||||
| 1351 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 1352 | Q_UNUSED(layer); | - | ||||||||||||||||||
| 1353 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1354 | if (needsFullSpec) {
| 0 | ||||||||||||||||||
| 1355 | texFuncs->glCompressedTextureImage1D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1356 | format, | - | ||||||||||||||||||
| 1357 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1358 | 0, dataSize, data, options); | - | ||||||||||||||||||
| 1359 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1360 | texFuncs->glCompressedTextureSubImage1D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1361 | 0, mipLevelSize( mipLevel, dimensions[0] ), | - | ||||||||||||||||||
| 1362 | format, dataSize, data, options); | - | ||||||||||||||||||
| 1363 | } never executed: end of block | 0 | ||||||||||||||||||
| 1364 | break; never executed: break; | 0 | ||||||||||||||||||
| 1365 | - | |||||||||||||||||||
| 1366 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 1367 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1368 | if (!needsFullSpec) {
| 0 | ||||||||||||||||||
| 1369 | texFuncs->glCompressedTextureSubImage2D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1370 | 0, layer, | - | ||||||||||||||||||
| 1371 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1372 | 1, | - | ||||||||||||||||||
| 1373 | format, dataSize, data, options); | - | ||||||||||||||||||
| 1374 | } never executed: end of block | 0 | ||||||||||||||||||
| 1375 | break; never executed: break; | 0 | ||||||||||||||||||
| 1376 | - | |||||||||||||||||||
| 1377 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 1378 | Q_UNUSED(layer); | - | ||||||||||||||||||
| 1379 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1380 | if (needsFullSpec) {
| 0 | ||||||||||||||||||
| 1381 | texFuncs->glCompressedTextureImage2D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1382 | format, | - | ||||||||||||||||||
| 1383 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1384 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1385 | 0, dataSize, data, options); | - | ||||||||||||||||||
| 1386 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1387 | texFuncs->glCompressedTextureSubImage2D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1388 | 0, 0, | - | ||||||||||||||||||
| 1389 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1390 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1391 | format, dataSize, data, options); | - | ||||||||||||||||||
| 1392 | } never executed: end of block | 0 | ||||||||||||||||||
| 1393 | break; never executed: break; | 0 | ||||||||||||||||||
| 1394 | - | |||||||||||||||||||
| 1395 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 1396 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1397 | if (!needsFullSpec) {
| 0 | ||||||||||||||||||
| 1398 | texFuncs->glCompressedTextureSubImage3D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1399 | 0, 0, layer, | - | ||||||||||||||||||
| 1400 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1401 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1402 | 1, | - | ||||||||||||||||||
| 1403 | format, dataSize, data, options); | - | ||||||||||||||||||
| 1404 | } never executed: end of block | 0 | ||||||||||||||||||
| 1405 | break; never executed: break; | 0 | ||||||||||||||||||
| 1406 | - | |||||||||||||||||||
| 1407 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 1408 | Q_UNUSED(cubeFace); | - | ||||||||||||||||||
| 1409 | if (needsFullSpec) {
| 0 | ||||||||||||||||||
| 1410 | texFuncs->glCompressedTextureImage3D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1411 | format, | - | ||||||||||||||||||
| 1412 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1413 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1414 | mipLevelSize(mipLevel, dimensions[2]), | - | ||||||||||||||||||
| 1415 | 0, dataSize, data, options); | - | ||||||||||||||||||
| 1416 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1417 | texFuncs->glCompressedTextureSubImage3D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1418 | 0, 0, layer, | - | ||||||||||||||||||
| 1419 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1420 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1421 | mipLevelSize(mipLevel, dimensions[2]), | - | ||||||||||||||||||
| 1422 | format, dataSize, data, options); | - | ||||||||||||||||||
| 1423 | } never executed: end of block | 0 | ||||||||||||||||||
| 1424 | break; never executed: break; | 0 | ||||||||||||||||||
| 1425 | - | |||||||||||||||||||
| 1426 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 1427 | Q_UNUSED(layer); | - | ||||||||||||||||||
| 1428 | if (needsFullSpec) {
| 0 | ||||||||||||||||||
| 1429 | texFuncs->glCompressedTextureImage2D(textureId, cubeFace, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1430 | format, | - | ||||||||||||||||||
| 1431 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1432 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1433 | 0, dataSize, data, options); | - | ||||||||||||||||||
| 1434 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1435 | texFuncs->glCompressedTextureSubImage2D(textureId, cubeFace, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1436 | 0, 0, | - | ||||||||||||||||||
| 1437 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1438 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1439 | format, dataSize, data, options); | - | ||||||||||||||||||
| 1440 | } never executed: end of block | 0 | ||||||||||||||||||
| 1441 | break; never executed: break; | 0 | ||||||||||||||||||
| 1442 | - | |||||||||||||||||||
| 1443 | case QOpenGLTexture::TargetCubeMapArray: { never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 1444 | int faceIndex = cubeFace - QOpenGLTexture::CubeMapPositiveX; | - | ||||||||||||||||||
| 1445 | int layerFace = 6 * layer + faceIndex; | - | ||||||||||||||||||
| 1446 | if (!needsFullSpec) {
| 0 | ||||||||||||||||||
| 1447 | texFuncs->glCompressedTextureSubImage3D(textureId, target, bindingTarget, mipLevel, | - | ||||||||||||||||||
| 1448 | 0, 0, layerFace, | - | ||||||||||||||||||
| 1449 | mipLevelSize(mipLevel, dimensions[0]), | - | ||||||||||||||||||
| 1450 | mipLevelSize(mipLevel, dimensions[1]), | - | ||||||||||||||||||
| 1451 | 1, | - | ||||||||||||||||||
| 1452 | format, dataSize, data, options); | - | ||||||||||||||||||
| 1453 | } never executed: end of block | 0 | ||||||||||||||||||
| 1454 | break; never executed: break; | 0 | ||||||||||||||||||
| 1455 | } | - | ||||||||||||||||||
| 1456 | - | |||||||||||||||||||
| 1457 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 1458 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 1459 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 1460 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 1461 | // We don't upload pixel data for these targets | - | ||||||||||||||||||
| 1462 | qWarning("QOpenGLTexture::setCompressedData(): Texture target does not support pixel data upload"); | - | ||||||||||||||||||
| 1463 | break; never executed: break; | 0 | ||||||||||||||||||
| 1464 | } | - | ||||||||||||||||||
| 1465 | - | |||||||||||||||||||
| 1466 | // If requested perform automatic mip map generation | - | ||||||||||||||||||
| 1467 | if (mipLevel == 0 && autoGenerateMipMaps && mipLevels > 1) {
| 0 | ||||||||||||||||||
| 1468 | Q_Q(QOpenGLTexture); | - | ||||||||||||||||||
| 1469 | q->generateMipMaps(); | - | ||||||||||||||||||
| 1470 | } never executed: end of block | 0 | ||||||||||||||||||
| 1471 | } never executed: end of block | 0 | ||||||||||||||||||
| 1472 | - | |||||||||||||||||||
| 1473 | void QOpenGLTexturePrivate::setWrapMode(QOpenGLTexture::WrapMode mode) | - | ||||||||||||||||||
| 1474 | { | - | ||||||||||||||||||
| 1475 | switch (target) { | - | ||||||||||||||||||
| 1476 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 1477 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 1478 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 1479 | wrapModes[0] = mode; | - | ||||||||||||||||||
| 1480 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_S, mode); | - | ||||||||||||||||||
| 1481 | break; never executed: break; | 0 | ||||||||||||||||||
| 1482 | - | |||||||||||||||||||
| 1483 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 1484 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 1485 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 1486 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 1487 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 1488 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 1489 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 1490 | wrapModes[0] = wrapModes[1] = mode; | - | ||||||||||||||||||
| 1491 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_S, mode); | - | ||||||||||||||||||
| 1492 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_T, mode); | - | ||||||||||||||||||
| 1493 | break; never executed: break; | 0 | ||||||||||||||||||
| 1494 | - | |||||||||||||||||||
| 1495 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 1496 | wrapModes[0] = wrapModes[1] = wrapModes[2] = mode; | - | ||||||||||||||||||
| 1497 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_S, mode); | - | ||||||||||||||||||
| 1498 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_T, mode); | - | ||||||||||||||||||
| 1499 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_R, mode); | - | ||||||||||||||||||
| 1500 | break; never executed: break; | 0 | ||||||||||||||||||
| 1501 | } | - | ||||||||||||||||||
| 1502 | } never executed: end of block | 0 | ||||||||||||||||||
| 1503 | - | |||||||||||||||||||
| 1504 | void QOpenGLTexturePrivate::setWrapMode(QOpenGLTexture::CoordinateDirection direction, QOpenGLTexture::WrapMode mode) | - | ||||||||||||||||||
| 1505 | { | - | ||||||||||||||||||
| 1506 | switch (target) { | - | ||||||||||||||||||
| 1507 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 1508 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 1509 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 1510 | switch (direction) { | - | ||||||||||||||||||
| 1511 | case QOpenGLTexture::DirectionS: never executed: case QOpenGLTexture::DirectionS: | 0 | ||||||||||||||||||
| 1512 | wrapModes[0] = mode; | - | ||||||||||||||||||
| 1513 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_S, mode); | - | ||||||||||||||||||
| 1514 | break; never executed: break; | 0 | ||||||||||||||||||
| 1515 | - | |||||||||||||||||||
| 1516 | case QOpenGLTexture::DirectionT: never executed: case QOpenGLTexture::DirectionT: | 0 | ||||||||||||||||||
| 1517 | case QOpenGLTexture::DirectionR: never executed: case QOpenGLTexture::DirectionR: | 0 | ||||||||||||||||||
| 1518 | qWarning("QOpenGLTexture::setWrapMode() direction not valid for this texture target"); | - | ||||||||||||||||||
| 1519 | break; never executed: break; | 0 | ||||||||||||||||||
| 1520 | } | - | ||||||||||||||||||
| 1521 | break; never executed: break; | 0 | ||||||||||||||||||
| 1522 | - | |||||||||||||||||||
| 1523 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 1524 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 1525 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 1526 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 1527 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 1528 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 1529 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 1530 | switch (direction) { | - | ||||||||||||||||||
| 1531 | case QOpenGLTexture::DirectionS: never executed: case QOpenGLTexture::DirectionS: | 0 | ||||||||||||||||||
| 1532 | wrapModes[0] = mode; | - | ||||||||||||||||||
| 1533 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_S, mode); | - | ||||||||||||||||||
| 1534 | break; never executed: break; | 0 | ||||||||||||||||||
| 1535 | - | |||||||||||||||||||
| 1536 | case QOpenGLTexture::DirectionT: never executed: case QOpenGLTexture::DirectionT: | 0 | ||||||||||||||||||
| 1537 | wrapModes[1] = mode; | - | ||||||||||||||||||
| 1538 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, GL_TEXTURE_WRAP_T, mode); | - | ||||||||||||||||||
| 1539 | break; never executed: break; | 0 | ||||||||||||||||||
| 1540 | - | |||||||||||||||||||
| 1541 | case QOpenGLTexture::DirectionR: never executed: case QOpenGLTexture::DirectionR: | 0 | ||||||||||||||||||
| 1542 | qWarning("QOpenGLTexture::setWrapMode() direction not valid for this texture target"); | - | ||||||||||||||||||
| 1543 | break; never executed: break; | 0 | ||||||||||||||||||
| 1544 | } | - | ||||||||||||||||||
| 1545 | break; never executed: break; | 0 | ||||||||||||||||||
| 1546 | - | |||||||||||||||||||
| 1547 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 1548 | switch (direction) { | - | ||||||||||||||||||
| 1549 | case QOpenGLTexture::DirectionS: never executed: case QOpenGLTexture::DirectionS: | 0 | ||||||||||||||||||
| 1550 | wrapModes[0] = mode; | - | ||||||||||||||||||
| 1551 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, direction, mode); | - | ||||||||||||||||||
| 1552 | break; never executed: break; | 0 | ||||||||||||||||||
| 1553 | - | |||||||||||||||||||
| 1554 | case QOpenGLTexture::DirectionT: never executed: case QOpenGLTexture::DirectionT: | 0 | ||||||||||||||||||
| 1555 | wrapModes[1] = mode; | - | ||||||||||||||||||
| 1556 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, direction, mode); | - | ||||||||||||||||||
| 1557 | break; never executed: break; | 0 | ||||||||||||||||||
| 1558 | - | |||||||||||||||||||
| 1559 | case QOpenGLTexture::DirectionR: never executed: case QOpenGLTexture::DirectionR: | 0 | ||||||||||||||||||
| 1560 | wrapModes[2] = mode; | - | ||||||||||||||||||
| 1561 | texFuncs->glTextureParameteri(textureId, target, bindingTarget, direction, mode); | - | ||||||||||||||||||
| 1562 | break; never executed: break; | 0 | ||||||||||||||||||
| 1563 | } | - | ||||||||||||||||||
| 1564 | break; never executed: break; | 0 | ||||||||||||||||||
| 1565 | } | - | ||||||||||||||||||
| 1566 | } never executed: end of block | 0 | ||||||||||||||||||
| 1567 | - | |||||||||||||||||||
| 1568 | QOpenGLTexture::WrapMode QOpenGLTexturePrivate::wrapMode(QOpenGLTexture::CoordinateDirection direction) const | - | ||||||||||||||||||
| 1569 | { | - | ||||||||||||||||||
| 1570 | switch (target) { | - | ||||||||||||||||||
| 1571 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 1572 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 1573 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 1574 | switch (direction) { | - | ||||||||||||||||||
| 1575 | case QOpenGLTexture::DirectionS: never executed: case QOpenGLTexture::DirectionS: | 0 | ||||||||||||||||||
| 1576 | return wrapModes[0]; never executed: return wrapModes[0]; | 0 | ||||||||||||||||||
| 1577 | - | |||||||||||||||||||
| 1578 | case QOpenGLTexture::DirectionT: never executed: case QOpenGLTexture::DirectionT: | 0 | ||||||||||||||||||
| 1579 | case QOpenGLTexture::DirectionR: never executed: case QOpenGLTexture::DirectionR: | 0 | ||||||||||||||||||
| 1580 | qWarning("QOpenGLTexture::wrapMode() direction not valid for this texture target"); | - | ||||||||||||||||||
| 1581 | return QOpenGLTexture::Repeat; never executed: return QOpenGLTexture::Repeat; | 0 | ||||||||||||||||||
| 1582 | } | - | ||||||||||||||||||
| 1583 | break; never executed: break; | 0 | ||||||||||||||||||
| 1584 | - | |||||||||||||||||||
| 1585 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 1586 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 1587 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 1588 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 1589 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 1590 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 1591 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 1592 | switch (direction) { | - | ||||||||||||||||||
| 1593 | case QOpenGLTexture::DirectionS: never executed: case QOpenGLTexture::DirectionS: | 0 | ||||||||||||||||||
| 1594 | return wrapModes[0]; never executed: return wrapModes[0]; | 0 | ||||||||||||||||||
| 1595 | - | |||||||||||||||||||
| 1596 | case QOpenGLTexture::DirectionT: never executed: case QOpenGLTexture::DirectionT: | 0 | ||||||||||||||||||
| 1597 | return wrapModes[1]; never executed: return wrapModes[1]; | 0 | ||||||||||||||||||
| 1598 | - | |||||||||||||||||||
| 1599 | case QOpenGLTexture::DirectionR: never executed: case QOpenGLTexture::DirectionR: | 0 | ||||||||||||||||||
| 1600 | qWarning("QOpenGLTexture::wrapMode() direction not valid for this texture target"); | - | ||||||||||||||||||
| 1601 | return QOpenGLTexture::Repeat; never executed: return QOpenGLTexture::Repeat; | 0 | ||||||||||||||||||
| 1602 | } | - | ||||||||||||||||||
| 1603 | break; never executed: break; | 0 | ||||||||||||||||||
| 1604 | - | |||||||||||||||||||
| 1605 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 1606 | switch (direction) { | - | ||||||||||||||||||
| 1607 | case QOpenGLTexture::DirectionS: never executed: case QOpenGLTexture::DirectionS: | 0 | ||||||||||||||||||
| 1608 | return wrapModes[0]; never executed: return wrapModes[0]; | 0 | ||||||||||||||||||
| 1609 | - | |||||||||||||||||||
| 1610 | case QOpenGLTexture::DirectionT: never executed: case QOpenGLTexture::DirectionT: | 0 | ||||||||||||||||||
| 1611 | return wrapModes[1]; never executed: return wrapModes[1]; | 0 | ||||||||||||||||||
| 1612 | - | |||||||||||||||||||
| 1613 | case QOpenGLTexture::DirectionR: never executed: case QOpenGLTexture::DirectionR: | 0 | ||||||||||||||||||
| 1614 | return wrapModes[2]; never executed: return wrapModes[2]; | 0 | ||||||||||||||||||
| 1615 | } | - | ||||||||||||||||||
| 1616 | break; never executed: break; | 0 | ||||||||||||||||||
| 1617 | } | - | ||||||||||||||||||
| 1618 | // Should never get here | - | ||||||||||||||||||
| 1619 | Q_ASSERT(false); | - | ||||||||||||||||||
| 1620 | return QOpenGLTexture::Repeat; never executed: return QOpenGLTexture::Repeat; | 0 | ||||||||||||||||||
| 1621 | } | - | ||||||||||||||||||
| 1622 | - | |||||||||||||||||||
| 1623 | QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target viewTarget, | - | ||||||||||||||||||
| 1624 | QOpenGLTexture::TextureFormat viewFormat, | - | ||||||||||||||||||
| 1625 | int minimumMipmapLevel, int maximumMipmapLevel, | - | ||||||||||||||||||
| 1626 | int minimumLayer, int maximumLayer) const | - | ||||||||||||||||||
| 1627 | { | - | ||||||||||||||||||
| 1628 | // Do sanity checks - see http://www.opengl.org/wiki/GLAPI/glTextureView | - | ||||||||||||||||||
| 1629 | - | |||||||||||||||||||
| 1630 | // Check the targets are compatible | - | ||||||||||||||||||
| 1631 | bool viewTargetCompatible = false; | - | ||||||||||||||||||
| 1632 | switch (target) { | - | ||||||||||||||||||
| 1633 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 1634 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 1635 | viewTargetCompatible = (viewTarget == QOpenGLTexture::Target1D
| 0 | ||||||||||||||||||
| 1636 | || viewTarget == QOpenGLTexture::Target1DArray);
| 0 | ||||||||||||||||||
| 1637 | break; never executed: break; | 0 | ||||||||||||||||||
| 1638 | - | |||||||||||||||||||
| 1639 | - | |||||||||||||||||||
| 1640 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 1641 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 1642 | viewTargetCompatible = (viewTarget == QOpenGLTexture::Target2D
| 0 | ||||||||||||||||||
| 1643 | || viewTarget == QOpenGLTexture::Target2DArray);
| 0 | ||||||||||||||||||
| 1644 | break; never executed: break; | 0 | ||||||||||||||||||
| 1645 | - | |||||||||||||||||||
| 1646 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 1647 | viewTargetCompatible = (viewTarget == QOpenGLTexture::Target3D); | - | ||||||||||||||||||
| 1648 | break; never executed: break; | 0 | ||||||||||||||||||
| 1649 | - | |||||||||||||||||||
| 1650 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 1651 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 1652 | viewTargetCompatible = (viewTarget == QOpenGLTexture::TargetCubeMap
| 0 | ||||||||||||||||||
| 1653 | || viewTarget == QOpenGLTexture::Target2D
| 0 | ||||||||||||||||||
| 1654 | || viewTarget == QOpenGLTexture::Target2DArray
| 0 | ||||||||||||||||||
| 1655 | || viewTarget == QOpenGLTexture::TargetCubeMapArray);
| 0 | ||||||||||||||||||
| 1656 | break; never executed: break; | 0 | ||||||||||||||||||
| 1657 | - | |||||||||||||||||||
| 1658 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 1659 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 1660 | viewTargetCompatible = (viewTarget == QOpenGLTexture::Target2DMultisample
| 0 | ||||||||||||||||||
| 1661 | || viewTarget == QOpenGLTexture::Target2DMultisampleArray);
| 0 | ||||||||||||||||||
| 1662 | break; never executed: break; | 0 | ||||||||||||||||||
| 1663 | - | |||||||||||||||||||
| 1664 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 1665 | viewTargetCompatible = (viewTarget == QOpenGLTexture::TargetRectangle); | - | ||||||||||||||||||
| 1666 | break; never executed: break; | 0 | ||||||||||||||||||
| 1667 | - | |||||||||||||||||||
| 1668 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 1669 | // Cannot be used with texture views | - | ||||||||||||||||||
| 1670 | break; never executed: break; | 0 | ||||||||||||||||||
| 1671 | } | - | ||||||||||||||||||
| 1672 | - | |||||||||||||||||||
| 1673 | if (!viewTargetCompatible) {
| 0 | ||||||||||||||||||
| 1674 | qWarning("QOpenGLTexture::createTextureView(): Incompatible source and view targets"); | - | ||||||||||||||||||
| 1675 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
| 1676 | } | - | ||||||||||||||||||
| 1677 | - | |||||||||||||||||||
| 1678 | // Check the formats are compatible | - | ||||||||||||||||||
| 1679 | bool viewFormatCompatible = false; | - | ||||||||||||||||||
| 1680 | switch (formatClass) { | - | ||||||||||||||||||
| 1681 | case QOpenGLTexture::NoFormatClass: never executed: case QOpenGLTexture::NoFormatClass: | 0 | ||||||||||||||||||
| 1682 | break; never executed: break; | 0 | ||||||||||||||||||
| 1683 | - | |||||||||||||||||||
| 1684 | case QOpenGLTexture::FormatClass_128Bit: never executed: case QOpenGLTexture::FormatClass_128Bit: | 0 | ||||||||||||||||||
| 1685 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGBA32F
| 0 | ||||||||||||||||||
| 1686 | || viewFormat == QOpenGLTexture::RGBA32U
| 0 | ||||||||||||||||||
| 1687 | || viewFormat == QOpenGLTexture::RGBA32I);
| 0 | ||||||||||||||||||
| 1688 | break; never executed: break; | 0 | ||||||||||||||||||
| 1689 | - | |||||||||||||||||||
| 1690 | case QOpenGLTexture::FormatClass_96Bit: never executed: case QOpenGLTexture::FormatClass_96Bit: | 0 | ||||||||||||||||||
| 1691 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB32F
| 0 | ||||||||||||||||||
| 1692 | || viewFormat == QOpenGLTexture::RGB32U
| 0 | ||||||||||||||||||
| 1693 | || viewFormat == QOpenGLTexture::RGB32I);
| 0 | ||||||||||||||||||
| 1694 | break; never executed: break; | 0 | ||||||||||||||||||
| 1695 | - | |||||||||||||||||||
| 1696 | case QOpenGLTexture::FormatClass_64Bit: never executed: case QOpenGLTexture::FormatClass_64Bit: | 0 | ||||||||||||||||||
| 1697 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGBA16F
| 0 | ||||||||||||||||||
| 1698 | || viewFormat == QOpenGLTexture::RG32F
| 0 | ||||||||||||||||||
| 1699 | || viewFormat == QOpenGLTexture::RGBA16U
| 0 | ||||||||||||||||||
| 1700 | || viewFormat == QOpenGLTexture::RG32U
| 0 | ||||||||||||||||||
| 1701 | || viewFormat == QOpenGLTexture::RGBA16I
| 0 | ||||||||||||||||||
| 1702 | || viewFormat == QOpenGLTexture::RG32I
| 0 | ||||||||||||||||||
| 1703 | || viewFormat == QOpenGLTexture::RGBA16_UNorm
| 0 | ||||||||||||||||||
| 1704 | || viewFormat == QOpenGLTexture::RGBA16_SNorm);
| 0 | ||||||||||||||||||
| 1705 | break; never executed: break; | 0 | ||||||||||||||||||
| 1706 | - | |||||||||||||||||||
| 1707 | case QOpenGLTexture::FormatClass_48Bit: never executed: case QOpenGLTexture::FormatClass_48Bit: | 0 | ||||||||||||||||||
| 1708 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB16_UNorm
| 0 | ||||||||||||||||||
| 1709 | || viewFormat == QOpenGLTexture::RGB16_SNorm
| 0 | ||||||||||||||||||
| 1710 | || viewFormat == QOpenGLTexture::RGB16F
| 0 | ||||||||||||||||||
| 1711 | || viewFormat == QOpenGLTexture::RGB16U
| 0 | ||||||||||||||||||
| 1712 | || viewFormat == QOpenGLTexture::RGB16I);
| 0 | ||||||||||||||||||
| 1713 | break; never executed: break; | 0 | ||||||||||||||||||
| 1714 | - | |||||||||||||||||||
| 1715 | case QOpenGLTexture::FormatClass_32Bit: never executed: case QOpenGLTexture::FormatClass_32Bit: | 0 | ||||||||||||||||||
| 1716 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RG16F
| 0 | ||||||||||||||||||
| 1717 | || viewFormat == QOpenGLTexture::RG11B10F
| 0 | ||||||||||||||||||
| 1718 | || viewFormat == QOpenGLTexture::R32F
| 0 | ||||||||||||||||||
| 1719 | || viewFormat == QOpenGLTexture::RGB10A2
| 0 | ||||||||||||||||||
| 1720 | || viewFormat == QOpenGLTexture::RGBA8U
| 0 | ||||||||||||||||||
| 1721 | || viewFormat == QOpenGLTexture::RG16U
| 0 | ||||||||||||||||||
| 1722 | || viewFormat == QOpenGLTexture::R32U
| 0 | ||||||||||||||||||
| 1723 | || viewFormat == QOpenGLTexture::RGBA8I
| 0 | ||||||||||||||||||
| 1724 | || viewFormat == QOpenGLTexture::RG16I
| 0 | ||||||||||||||||||
| 1725 | || viewFormat == QOpenGLTexture::R32I
| 0 | ||||||||||||||||||
| 1726 | || viewFormat == QOpenGLTexture::RGBA8_UNorm
| 0 | ||||||||||||||||||
| 1727 | || viewFormat == QOpenGLTexture::RG16_UNorm
| 0 | ||||||||||||||||||
| 1728 | || viewFormat == QOpenGLTexture::RGBA8_SNorm
| 0 | ||||||||||||||||||
| 1729 | || viewFormat == QOpenGLTexture::RG16_SNorm
| 0 | ||||||||||||||||||
| 1730 | || viewFormat == QOpenGLTexture::SRGB8_Alpha8
| 0 | ||||||||||||||||||
| 1731 | || viewFormat == QOpenGLTexture::RGB9E5);
| 0 | ||||||||||||||||||
| 1732 | break; never executed: break; | 0 | ||||||||||||||||||
| 1733 | - | |||||||||||||||||||
| 1734 | case QOpenGLTexture::FormatClass_24Bit: never executed: case QOpenGLTexture::FormatClass_24Bit: | 0 | ||||||||||||||||||
| 1735 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB8_UNorm
| 0 | ||||||||||||||||||
| 1736 | || viewFormat == QOpenGLTexture::RGB8_SNorm
| 0 | ||||||||||||||||||
| 1737 | || viewFormat == QOpenGLTexture::SRGB8
| 0 | ||||||||||||||||||
| 1738 | || viewFormat == QOpenGLTexture::RGB8U
| 0 | ||||||||||||||||||
| 1739 | || viewFormat == QOpenGLTexture::RGB8I);
| 0 | ||||||||||||||||||
| 1740 | break; never executed: break; | 0 | ||||||||||||||||||
| 1741 | - | |||||||||||||||||||
| 1742 | case QOpenGLTexture::FormatClass_16Bit: never executed: case QOpenGLTexture::FormatClass_16Bit: | 0 | ||||||||||||||||||
| 1743 | viewFormatCompatible = (viewFormat == QOpenGLTexture::R16F
| 0 | ||||||||||||||||||
| 1744 | || viewFormat == QOpenGLTexture::RG8U
| 0 | ||||||||||||||||||
| 1745 | || viewFormat == QOpenGLTexture::R16U
| 0 | ||||||||||||||||||
| 1746 | || viewFormat == QOpenGLTexture::RG8I
| 0 | ||||||||||||||||||
| 1747 | || viewFormat == QOpenGLTexture::R16I
| 0 | ||||||||||||||||||
| 1748 | || viewFormat == QOpenGLTexture::RG8_UNorm
| 0 | ||||||||||||||||||
| 1749 | || viewFormat == QOpenGLTexture::R16_UNorm
| 0 | ||||||||||||||||||
| 1750 | || viewFormat == QOpenGLTexture::RG8_SNorm
| 0 | ||||||||||||||||||
| 1751 | || viewFormat == QOpenGLTexture::R16_SNorm);
| 0 | ||||||||||||||||||
| 1752 | break; never executed: break; | 0 | ||||||||||||||||||
| 1753 | - | |||||||||||||||||||
| 1754 | case QOpenGLTexture::FormatClass_8Bit: never executed: case QOpenGLTexture::FormatClass_8Bit: | 0 | ||||||||||||||||||
| 1755 | viewFormatCompatible = (viewFormat == QOpenGLTexture::R8U
| 0 | ||||||||||||||||||
| 1756 | || viewFormat == QOpenGLTexture::R8I
| 0 | ||||||||||||||||||
| 1757 | || viewFormat == QOpenGLTexture::R8_UNorm
| 0 | ||||||||||||||||||
| 1758 | || viewFormat == QOpenGLTexture::R8_SNorm);
| 0 | ||||||||||||||||||
| 1759 | break; never executed: break; | 0 | ||||||||||||||||||
| 1760 | - | |||||||||||||||||||
| 1761 | case QOpenGLTexture::FormatClass_RGTC1_R: never executed: case QOpenGLTexture::FormatClass_RGTC1_R: | 0 | ||||||||||||||||||
| 1762 | viewFormatCompatible = (viewFormat == QOpenGLTexture::R_ATI1N_UNorm
| 0 | ||||||||||||||||||
| 1763 | || viewFormat == QOpenGLTexture::R_ATI1N_SNorm);
| 0 | ||||||||||||||||||
| 1764 | break; never executed: break; | 0 | ||||||||||||||||||
| 1765 | - | |||||||||||||||||||
| 1766 | case QOpenGLTexture::FormatClass_RGTC2_RG: never executed: case QOpenGLTexture::FormatClass_RGTC2_RG: | 0 | ||||||||||||||||||
| 1767 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RG_ATI2N_UNorm
| 0 | ||||||||||||||||||
| 1768 | || viewFormat == QOpenGLTexture::RG_ATI2N_SNorm);
| 0 | ||||||||||||||||||
| 1769 | break; never executed: break; | 0 | ||||||||||||||||||
| 1770 | - | |||||||||||||||||||
| 1771 | case QOpenGLTexture::FormatClass_BPTC_Unorm: never executed: case QOpenGLTexture::FormatClass_BPTC_Unorm: | 0 | ||||||||||||||||||
| 1772 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB_BP_UNorm
| 0 | ||||||||||||||||||
| 1773 | || viewFormat == QOpenGLTexture::SRGB_BP_UNorm);
| 0 | ||||||||||||||||||
| 1774 | break; never executed: break; | 0 | ||||||||||||||||||
| 1775 | - | |||||||||||||||||||
| 1776 | case QOpenGLTexture::FormatClass_BPTC_Float: never executed: case QOpenGLTexture::FormatClass_BPTC_Float: | 0 | ||||||||||||||||||
| 1777 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT
| 0 | ||||||||||||||||||
| 1778 | || viewFormat == QOpenGLTexture::RGB_BP_SIGNED_FLOAT);
| 0 | ||||||||||||||||||
| 1779 | break; never executed: break; | 0 | ||||||||||||||||||
| 1780 | - | |||||||||||||||||||
| 1781 | case QOpenGLTexture::FormatClass_S3TC_DXT1_RGB: never executed: case QOpenGLTexture::FormatClass_S3TC_DXT1_RGB: | 0 | ||||||||||||||||||
| 1782 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGB_DXT1
| 0 | ||||||||||||||||||
| 1783 | || viewFormat == QOpenGLTexture::SRGB_DXT1);
| 0 | ||||||||||||||||||
| 1784 | break; never executed: break; | 0 | ||||||||||||||||||
| 1785 | - | |||||||||||||||||||
| 1786 | case QOpenGLTexture::FormatClass_S3TC_DXT1_RGBA: never executed: case QOpenGLTexture::FormatClass_S3TC_DXT1_RGBA: | 0 | ||||||||||||||||||
| 1787 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGBA_DXT1
| 0 | ||||||||||||||||||
| 1788 | || viewFormat == QOpenGLTexture::SRGB_Alpha_DXT1);
| 0 | ||||||||||||||||||
| 1789 | break; never executed: break; | 0 | ||||||||||||||||||
| 1790 | - | |||||||||||||||||||
| 1791 | case QOpenGLTexture::FormatClass_S3TC_DXT3_RGBA: never executed: case QOpenGLTexture::FormatClass_S3TC_DXT3_RGBA: | 0 | ||||||||||||||||||
| 1792 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGBA_DXT3
| 0 | ||||||||||||||||||
| 1793 | || viewFormat == QOpenGLTexture::SRGB_Alpha_DXT3);
| 0 | ||||||||||||||||||
| 1794 | break; never executed: break; | 0 | ||||||||||||||||||
| 1795 | - | |||||||||||||||||||
| 1796 | case QOpenGLTexture::FormatClass_S3TC_DXT5_RGBA: never executed: case QOpenGLTexture::FormatClass_S3TC_DXT5_RGBA: | 0 | ||||||||||||||||||
| 1797 | viewFormatCompatible = (viewFormat == QOpenGLTexture::RGBA_DXT5
| 0 | ||||||||||||||||||
| 1798 | || viewFormat == QOpenGLTexture::SRGB_Alpha_DXT5);
| 0 | ||||||||||||||||||
| 1799 | break; never executed: break; | 0 | ||||||||||||||||||
| 1800 | - | |||||||||||||||||||
| 1801 | case QOpenGLTexture::FormatClass_Unique: never executed: case QOpenGLTexture::FormatClass_Unique: | 0 | ||||||||||||||||||
| 1802 | viewFormatCompatible = (viewFormat == format); | - | ||||||||||||||||||
| 1803 | break; never executed: break; | 0 | ||||||||||||||||||
| 1804 | } | - | ||||||||||||||||||
| 1805 | - | |||||||||||||||||||
| 1806 | if (!viewFormatCompatible) {
| 0 | ||||||||||||||||||
| 1807 | qWarning("QOpenGLTexture::createTextureView(): Incompatible source and view formats"); | - | ||||||||||||||||||
| 1808 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
| 1809 | } | - | ||||||||||||||||||
| 1810 | - | |||||||||||||||||||
| 1811 | - | |||||||||||||||||||
| 1812 | // Create a view | - | ||||||||||||||||||
| 1813 | QOpenGLTexture *view = new QOpenGLTexture(viewTarget); | - | ||||||||||||||||||
| 1814 | view->setFormat(viewFormat); | - | ||||||||||||||||||
| 1815 | view->create(); | - | ||||||||||||||||||
| 1816 | view->d_ptr->textureView = true; | - | ||||||||||||||||||
| 1817 | texFuncs->glTextureView(view->textureId(), viewTarget, textureId, viewFormat, | - | ||||||||||||||||||
| 1818 | minimumMipmapLevel, maximumMipmapLevel - minimumMipmapLevel + 1, | - | ||||||||||||||||||
| 1819 | minimumLayer, maximumLayer - minimumLayer + 1); | - | ||||||||||||||||||
| 1820 | return view; never executed: return view; | 0 | ||||||||||||||||||
| 1821 | } | - | ||||||||||||||||||
| 1822 | - | |||||||||||||||||||
| 1823 | - | |||||||||||||||||||
| 1824 | /*! | - | ||||||||||||||||||
| 1825 | \class QOpenGLTexture | - | ||||||||||||||||||
| 1826 | \inmodule QtGui | - | ||||||||||||||||||
| 1827 | \since 5.2 | - | ||||||||||||||||||
| 1828 | \wrapper | - | ||||||||||||||||||
| 1829 | \brief The QOpenGLTexture class encapsulates an OpenGL texture object. | - | ||||||||||||||||||
| 1830 | - | |||||||||||||||||||
| 1831 | QOpenGLTexture makes it easy to work with OpenGL textures and the myriad features | - | ||||||||||||||||||
| 1832 | and targets that they offer depending upon the capabilities of your OpenGL implementation. | - | ||||||||||||||||||
| 1833 | - | |||||||||||||||||||
| 1834 | The typical usage pattern for QOpenGLTexture is | - | ||||||||||||||||||
| 1835 | \list | - | ||||||||||||||||||
| 1836 | \li Instantiate the object specifying the texture target type | - | ||||||||||||||||||
| 1837 | \li Set properties that affect the storage requirements e.g. storage format, dimensions | - | ||||||||||||||||||
| 1838 | \li Allocate the server-side storage | - | ||||||||||||||||||
| 1839 | \li Optionally upload pixel data | - | ||||||||||||||||||
| 1840 | \li Optionally set any additional properties e.g. filtering and border options | - | ||||||||||||||||||
| 1841 | \li Render with texture or render to texture | - | ||||||||||||||||||
| 1842 | \endlist | - | ||||||||||||||||||
| 1843 | - | |||||||||||||||||||
| 1844 | In the common case of simply using a QImage as the source of texture pixel data | - | ||||||||||||||||||
| 1845 | most of the above steps are performed automatically. | - | ||||||||||||||||||
| 1846 | - | |||||||||||||||||||
| 1847 | \code | - | ||||||||||||||||||
| 1848 | // Prepare texture | - | ||||||||||||||||||
| 1849 | QOpenGLTexture *texture = new QOpenGLTexture(QImage(fileName).mirrored()); | - | ||||||||||||||||||
| 1850 | texture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear); | - | ||||||||||||||||||
| 1851 | texture->setMagnificationFilter(QOpenGLTexture::Linear); | - | ||||||||||||||||||
| 1852 | ... | - | ||||||||||||||||||
| 1853 | // Render with texture | - | ||||||||||||||||||
| 1854 | texture->bind(); | - | ||||||||||||||||||
| 1855 | glDrawArrays(...); | - | ||||||||||||||||||
| 1856 | \endcode | - | ||||||||||||||||||
| 1857 | - | |||||||||||||||||||
| 1858 | Note that the QImage is mirrored vertically to account for the fact that | - | ||||||||||||||||||
| 1859 | OpenGL and QImage use opposite directions for the y axis. Another option | - | ||||||||||||||||||
| 1860 | would be to transform your texture coordinates. | - | ||||||||||||||||||
| 1861 | */ | - | ||||||||||||||||||
| 1862 | - | |||||||||||||||||||
| 1863 | /*! | - | ||||||||||||||||||
| 1864 | \enum QOpenGLTexture::Filter | - | ||||||||||||||||||
| 1865 | This enum defines the filtering parameters for a QOpenGLTexture object. | - | ||||||||||||||||||
| 1866 | \value Nearest Equivalent to GL_NEAREST | - | ||||||||||||||||||
| 1867 | \value Linear Equivalent to GL_LINEAR | - | ||||||||||||||||||
| 1868 | \value NearestMipMapNearest Equivalent to GL_NEAREST_MIPMAP_NEAREST | - | ||||||||||||||||||
| 1869 | \value NearestMipMapLinear Equivalent to GL_NEAREST_MIPMAP_LINEAR | - | ||||||||||||||||||
| 1870 | \value LinearMipMapNearest Equivalent to GL_LINEAR_MIPMAP_NEAREST | - | ||||||||||||||||||
| 1871 | \value LinearMipMapLinear Equivalent to GL_LINEAR_MIPMAP_LINEAR | - | ||||||||||||||||||
| 1872 | */ | - | ||||||||||||||||||
| 1873 | - | |||||||||||||||||||
| 1874 | /*! | - | ||||||||||||||||||
| 1875 | \enum QOpenGLTexture::Target | - | ||||||||||||||||||
| 1876 | This enum defines the texture target of a QOpenGLTexture object. | - | ||||||||||||||||||
| 1877 | - | |||||||||||||||||||
| 1878 | \value Target1D A 1-dimensional texture. | - | ||||||||||||||||||
| 1879 | Equivalent to GL_TEXTURE_1D. | - | ||||||||||||||||||
| 1880 | \value Target1DArray An array of 1-dimensional textures. | - | ||||||||||||||||||
| 1881 | Equivalent to GL_TEXTURE_1D_ARRAY | - | ||||||||||||||||||
| 1882 | \value Target2D A 2-dimensional texture. | - | ||||||||||||||||||
| 1883 | Equivalent to GL_TEXTURE_2D | - | ||||||||||||||||||
| 1884 | \value Target2DArray An array of 1-dimensional textures. | - | ||||||||||||||||||
| 1885 | Equivalent to GL_TEXTURE_2D_ARRAY | - | ||||||||||||||||||
| 1886 | \value Target3D A 3-dimensional texture. | - | ||||||||||||||||||
| 1887 | Equivalent to GL_TEXTURE_3D | - | ||||||||||||||||||
| 1888 | \value TargetCubeMap A cubemap texture. | - | ||||||||||||||||||
| 1889 | Equivalent to GL_TEXTURE_CUBE_MAP | - | ||||||||||||||||||
| 1890 | \value TargetCubeMapArray An array of cubemap textures. | - | ||||||||||||||||||
| 1891 | Equivalent to GL_TEXTURE_CUBE_MAP_ARRAY | - | ||||||||||||||||||
| 1892 | \value Target2DMultisample A 2-dimensional texture with multisample support. | - | ||||||||||||||||||
| 1893 | Equivalent to GL_TEXTURE_2D_MULTISAMPLE | - | ||||||||||||||||||
| 1894 | \value Target2DMultisampleArray An array of 2-dimensional textures with multisample support. | - | ||||||||||||||||||
| 1895 | Equivalent to GL_TEXTURE_2D_MULTISAMPLE_ARRAY | - | ||||||||||||||||||
| 1896 | \value TargetRectangle A rectangular 2-dimensional texture. | - | ||||||||||||||||||
| 1897 | Equivalent to GL_TEXTURE_RECTANGLE | - | ||||||||||||||||||
| 1898 | \value TargetBuffer A texture with data from an OpenGL buffer object. | - | ||||||||||||||||||
| 1899 | Equivalent to GL_TEXTURE_BUFFER | - | ||||||||||||||||||
| 1900 | */ | - | ||||||||||||||||||
| 1901 | - | |||||||||||||||||||
| 1902 | /*! | - | ||||||||||||||||||
| 1903 | \enum QOpenGLTexture::BindingTarget | - | ||||||||||||||||||
| 1904 | This enum defines the possible binding targets of texture units. | - | ||||||||||||||||||
| 1905 | - | |||||||||||||||||||
| 1906 | \value BindingTarget1D Equivalent to GL_TEXTURE_BINDING_1D | - | ||||||||||||||||||
| 1907 | \value BindingTarget1DArray Equivalent to GL_TEXTURE_BINDING_1D_ARRAY | - | ||||||||||||||||||
| 1908 | \value BindingTarget2D Equivalent to GL_TEXTURE_BINDING_2D | - | ||||||||||||||||||
| 1909 | \value BindingTarget2DArray Equivalent to GL_TEXTURE_BINDING_2D_ARRAY | - | ||||||||||||||||||
| 1910 | \value BindingTarget3D Equivalent to GL_TEXTURE_BINDING_3D | - | ||||||||||||||||||
| 1911 | \value BindingTargetCubeMap Equivalent to GL_TEXTURE_BINDING_CUBE_MAP | - | ||||||||||||||||||
| 1912 | \value BindingTargetCubeMapArray Equivalent to GL_TEXTURE_BINDING_CUBE_MAP_ARRAY | - | ||||||||||||||||||
| 1913 | \value BindingTarget2DMultisample Equivalent to GL_TEXTURE_BINDING_2D_MULTISAMPLE | - | ||||||||||||||||||
| 1914 | \value BindingTarget2DMultisampleArray Equivalent to GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY | - | ||||||||||||||||||
| 1915 | \value BindingTargetRectangle Equivalent to GL_TEXTURE_BINDING_RECTANGLE | - | ||||||||||||||||||
| 1916 | \value BindingTargetBuffer Equivalent to GL_TEXTURE_BINDING_BUFFER | - | ||||||||||||||||||
| 1917 | */ | - | ||||||||||||||||||
| 1918 | - | |||||||||||||||||||
| 1919 | /*! | - | ||||||||||||||||||
| 1920 | \enum QOpenGLTexture::MipMapGeneration | - | ||||||||||||||||||
| 1921 | This enum defines the options to control mipmap generation. | - | ||||||||||||||||||
| 1922 | - | |||||||||||||||||||
| 1923 | \value GenerateMipMaps Mipmaps should be generated | - | ||||||||||||||||||
| 1924 | \value DontGenerateMipMaps Mipmaps should not be generated | - | ||||||||||||||||||
| 1925 | */ | - | ||||||||||||||||||
| 1926 | - | |||||||||||||||||||
| 1927 | /*! | - | ||||||||||||||||||
| 1928 | \enum QOpenGLTexture::TextureUnitReset | - | ||||||||||||||||||
| 1929 | This enum defines options ot control texture unit activation. | - | ||||||||||||||||||
| 1930 | - | |||||||||||||||||||
| 1931 | \value ResetTextureUnit The previous active texture unit will be reset | - | ||||||||||||||||||
| 1932 | \value DontResetTextureUnit The previous active texture unit will not be rest | - | ||||||||||||||||||
| 1933 | */ | - | ||||||||||||||||||
| 1934 | - | |||||||||||||||||||
| 1935 | /*! | - | ||||||||||||||||||
| 1936 | \enum QOpenGLTexture::TextureFormat | - | ||||||||||||||||||
| 1937 | This enum defines the possible texture formats. Depending upon your OpenGL | - | ||||||||||||||||||
| 1938 | implementation only a subset of these may be supported. | - | ||||||||||||||||||
| 1939 | - | |||||||||||||||||||
| 1940 | \value NoFormat Equivalent to GL_NONE | - | ||||||||||||||||||
| 1941 | - | |||||||||||||||||||
| 1942 | \value R8_UNorm Equivalent to GL_R8 | - | ||||||||||||||||||
| 1943 | \value RG8_UNorm Equivalent to GL_RG8 | - | ||||||||||||||||||
| 1944 | \value RGB8_UNorm Equivalent to GL_RGB8 | - | ||||||||||||||||||
| 1945 | \value RGBA8_UNorm Equivalent to GL_RGBA8 | - | ||||||||||||||||||
| 1946 | - | |||||||||||||||||||
| 1947 | \value R16_UNorm Equivalent to GL_R16 | - | ||||||||||||||||||
| 1948 | \value RG16_UNorm Equivalent to GL_RG16 | - | ||||||||||||||||||
| 1949 | \value RGB16_UNorm Equivalent to GL_RGB16 | - | ||||||||||||||||||
| 1950 | \value RGBA16_UNorm Equivalent to GL_RGBA16 | - | ||||||||||||||||||
| 1951 | - | |||||||||||||||||||
| 1952 | \value R8_SNorm Equivalent to GL_R8_SNORM | - | ||||||||||||||||||
| 1953 | \value RG8_SNorm Equivalent to GL_RG8_SNORM | - | ||||||||||||||||||
| 1954 | \value RGB8_SNorm Equivalent to GL_RGB8_SNORM | - | ||||||||||||||||||
| 1955 | \value RGBA8_SNorm Equivalent to GL_RGBA8_SNORM | - | ||||||||||||||||||
| 1956 | - | |||||||||||||||||||
| 1957 | \value R16_SNorm Equivalent to GL_R16_SNORM | - | ||||||||||||||||||
| 1958 | \value RG16_SNorm Equivalent to GL_RG16_SNORM | - | ||||||||||||||||||
| 1959 | \value RGB16_SNorm Equivalent to GL_RGB16_SNORM | - | ||||||||||||||||||
| 1960 | \value RGBA16_SNorm Equivalent to GL_RGBA16_SNORM | - | ||||||||||||||||||
| 1961 | - | |||||||||||||||||||
| 1962 | \value R8U Equivalent to GL_R8UI | - | ||||||||||||||||||
| 1963 | \value RG8U Equivalent to GL_RG8UI | - | ||||||||||||||||||
| 1964 | \value RGB8U Equivalent to GL_RGB8UI | - | ||||||||||||||||||
| 1965 | \value RGBA8U Equivalent to GL_RGBA8UI | - | ||||||||||||||||||
| 1966 | - | |||||||||||||||||||
| 1967 | \value R16U Equivalent to GL_R16UI | - | ||||||||||||||||||
| 1968 | \value RG16U Equivalent to GL_RG16UI | - | ||||||||||||||||||
| 1969 | \value RGB16U Equivalent to GL_RGB16UI | - | ||||||||||||||||||
| 1970 | \value RGBA16U Equivalent to GL_RGBA16UI | - | ||||||||||||||||||
| 1971 | - | |||||||||||||||||||
| 1972 | \value R32U Equivalent to GL_R32UI | - | ||||||||||||||||||
| 1973 | \value RG32U Equivalent to GL_RG32UI | - | ||||||||||||||||||
| 1974 | \value RGB32U Equivalent to GL_RGB32UI | - | ||||||||||||||||||
| 1975 | \value RGBA32U Equivalent to GL_RGBA32UI | - | ||||||||||||||||||
| 1976 | - | |||||||||||||||||||
| 1977 | \value R8I Equivalent to GL_R8I | - | ||||||||||||||||||
| 1978 | \value RG8I Equivalent to GL_RG8I | - | ||||||||||||||||||
| 1979 | \value RGB8I Equivalent to GL_RGB8I | - | ||||||||||||||||||
| 1980 | \value RGBA8I Equivalent to GL_RGBA8I | - | ||||||||||||||||||
| 1981 | - | |||||||||||||||||||
| 1982 | \value R16I Equivalent to GL_R16I | - | ||||||||||||||||||
| 1983 | \value RG16I Equivalent to GL_RG16I | - | ||||||||||||||||||
| 1984 | \value RGB16I Equivalent to GL_RGB16I | - | ||||||||||||||||||
| 1985 | \value RGBA16I Equivalent to GL_RGBA16I | - | ||||||||||||||||||
| 1986 | - | |||||||||||||||||||
| 1987 | \value R32I Equivalent to GL_R32I | - | ||||||||||||||||||
| 1988 | \value RG32I Equivalent to GL_RG32I | - | ||||||||||||||||||
| 1989 | \value RGB32I Equivalent to GL_RGB32I | - | ||||||||||||||||||
| 1990 | \value RGBA32I Equivalent to GL_RGBA32I | - | ||||||||||||||||||
| 1991 | - | |||||||||||||||||||
| 1992 | \value R16F Equivalent to GL_R16F | - | ||||||||||||||||||
| 1993 | \value RG16F Equivalent to GL_RG16F | - | ||||||||||||||||||
| 1994 | \value RGB16F Equivalent to GL_RGB16F | - | ||||||||||||||||||
| 1995 | \value RGBA16F Equivalent to GL_RGBA16F | - | ||||||||||||||||||
| 1996 | - | |||||||||||||||||||
| 1997 | \value R32F Equivalent to GL_R32F | - | ||||||||||||||||||
| 1998 | \value RG32F Equivalent to GL_RG32F | - | ||||||||||||||||||
| 1999 | \value RGB32F Equivalent to GL_RGB32F | - | ||||||||||||||||||
| 2000 | \value RGBA32F Equivalent to GL_RGBA32F | - | ||||||||||||||||||
| 2001 | - | |||||||||||||||||||
| 2002 | \value RGB9E5 Equivalent to GL_RGB9_E5 | - | ||||||||||||||||||
| 2003 | \value RG11B10F Equivalent to GL_R11F_G11F_B10F | - | ||||||||||||||||||
| 2004 | \value RG3B2 Equivalent to GL_R3_G3_B2 | - | ||||||||||||||||||
| 2005 | \value R5G6B5 Equivalent to GL_RGB565 | - | ||||||||||||||||||
| 2006 | \value RGB5A1 Equivalent to GL_RGB5_A1 | - | ||||||||||||||||||
| 2007 | \value RGBA4 Equivalent to GL_RGBA4 | - | ||||||||||||||||||
| 2008 | \value RGB10A2 Equivalent to GL_RGB10_A2UI | - | ||||||||||||||||||
| 2009 | - | |||||||||||||||||||
| 2010 | \value D16 Equivalent to GL_DEPTH_COMPONENT16 | - | ||||||||||||||||||
| 2011 | \value D24 Equivalent to GL_DEPTH_COMPONENT24 | - | ||||||||||||||||||
| 2012 | \value D24S8 Equivalent to GL_DEPTH24_STENCIL8 | - | ||||||||||||||||||
| 2013 | \value D32 Equivalent to GL_DEPTH_COMPONENT32 | - | ||||||||||||||||||
| 2014 | \value D32F Equivalent to GL_DEPTH_COMPONENT32F | - | ||||||||||||||||||
| 2015 | \value D32FS8X24 Equivalent to GL_DEPTH32F_STENCIL8 | - | ||||||||||||||||||
| 2016 | \value S8 Equivalent to GL_STENCIL_INDEX8. Introduced in Qt 5.4 | - | ||||||||||||||||||
| 2017 | - | |||||||||||||||||||
| 2018 | \value RGB_DXT1 Equivalent to GL_COMPRESSED_RGB_S3TC_DXT1_EXT | - | ||||||||||||||||||
| 2019 | \value RGBA_DXT1 Equivalent to GL_COMPRESSED_RGBA_S3TC_DXT1_EXT | - | ||||||||||||||||||
| 2020 | \value RGBA_DXT3 Equivalent to GL_COMPRESSED_RGBA_S3TC_DXT3_EXT | - | ||||||||||||||||||
| 2021 | \value RGBA_DXT5 Equivalent to GL_COMPRESSED_RGBA_S3TC_DXT5_EXT | - | ||||||||||||||||||
| 2022 | \value R_ATI1N_UNorm Equivalent to GL_COMPRESSED_RED_RGTC1 | - | ||||||||||||||||||
| 2023 | \value R_ATI1N_SNorm Equivalent to GL_COMPRESSED_SIGNED_RED_RGTC1 | - | ||||||||||||||||||
| 2024 | \value RG_ATI2N_UNorm Equivalent to GL_COMPRESSED_RG_RGTC2 | - | ||||||||||||||||||
| 2025 | \value RG_ATI2N_SNorm Equivalent to GL_COMPRESSED_SIGNED_RG_RGTC2 | - | ||||||||||||||||||
| 2026 | \value RGB_BP_UNSIGNED_FLOAT Equivalent to GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB | - | ||||||||||||||||||
| 2027 | \value RGB_BP_SIGNED_FLOAT Equivalent to GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB | - | ||||||||||||||||||
| 2028 | \value RGB_BP_UNorm Equivalent to GL_COMPRESSED_RGBA_BPTC_UNORM_ARB | - | ||||||||||||||||||
| 2029 | \value R11_EAC_UNorm Equivalent to GL_COMPRESSED_R11_EAC | - | ||||||||||||||||||
| 2030 | \value R11_EAC_SNorm Equivalent to GL_COMPRESSED_SIGNED_R11_EAC | - | ||||||||||||||||||
| 2031 | \value RG11_EAC_UNorm Equivalent to GL_COMPRESSED_RG11_EAC | - | ||||||||||||||||||
| 2032 | \value RG11_EAC_SNorm Equivalent to GL_COMPRESSED_SIGNED_RG11_EAC | - | ||||||||||||||||||
| 2033 | \value RGB8_ETC2 Equivalent to GL_COMPRESSED_RGB8_ETC2 | - | ||||||||||||||||||
| 2034 | \value SRGB8_ETC2 Equivalent to GL_COMPRESSED_SRGB8_ETC2 | - | ||||||||||||||||||
| 2035 | \value RGB8_PunchThrough_Alpha1_ETC2 Equivalent to GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 | - | ||||||||||||||||||
| 2036 | \value SRGB8_PunchThrough_Alpha1_ETC2 Equivalent to GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 | - | ||||||||||||||||||
| 2037 | \value RGBA8_ETC2_EAC Equivalent to GL_COMPRESSED_RGBA8_ETC2_EAC | - | ||||||||||||||||||
| 2038 | \value SRGB8_Alpha8_ETC2_EAC Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC | - | ||||||||||||||||||
| 2039 | \value RGB8_ETC1 Equivalent to GL_ETC1_RGB8_OES | - | ||||||||||||||||||
| 2040 | - | |||||||||||||||||||
| 2041 | \value SRGB8 Equivalent to GL_SRGB8 | - | ||||||||||||||||||
| 2042 | \value SRGB8_Alpha8 Equivalent to GL_SRGB8_ALPHA8 | - | ||||||||||||||||||
| 2043 | \value SRGB_DXT1 Equivalent to GL_COMPRESSED_SRGB_S3TC_DXT1_EXT | - | ||||||||||||||||||
| 2044 | \value SRGB_Alpha_DXT1 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT | - | ||||||||||||||||||
| 2045 | \value SRGB_Alpha_DXT3 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT | - | ||||||||||||||||||
| 2046 | \value SRGB_Alpha_DXT5 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT | - | ||||||||||||||||||
| 2047 | \value SRGB_BP_UNorm Equivalent to GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB | - | ||||||||||||||||||
| 2048 | - | |||||||||||||||||||
| 2049 | \value DepthFormat Equivalent to GL_DEPTH_COMPONENT (only OpenGL ES 3 or ES 2 with OES_depth_texture) | - | ||||||||||||||||||
| 2050 | \value AlphaFormat Equivalent to GL_ALPHA (OpenGL ES 2 only) | - | ||||||||||||||||||
| 2051 | \value RGBFormat Equivalent to GL_RGB (OpenGL ES 2 only) | - | ||||||||||||||||||
| 2052 | \value RGBAFormat Equivalent to GL_RGBA (OpenGL ES 2 only) | - | ||||||||||||||||||
| 2053 | \value LuminanceFormat Equivalent to GL_LUMINANCE (OpenGL ES 2 only) | - | ||||||||||||||||||
| 2054 | \value LuminanceAlphaFormat Equivalent to GL_LUMINANCE_ALPHA (OpenGL ES 2 only) | - | ||||||||||||||||||
| 2055 | */ | - | ||||||||||||||||||
| 2056 | - | |||||||||||||||||||
| 2057 | /*! | - | ||||||||||||||||||
| 2058 | \enum QOpenGLTexture::CubeMapFace | - | ||||||||||||||||||
| 2059 | This enum defines the possible CubeMap faces. | - | ||||||||||||||||||
| 2060 | - | |||||||||||||||||||
| 2061 | \value CubeMapPositiveX Equivalent to GL_TEXTURE_CUBE_MAP_POSITIVE_X | - | ||||||||||||||||||
| 2062 | \value CubeMapNegativeX Equivalent to GL_TEXTURE_CUBE_MAP_NEGATIVE_X | - | ||||||||||||||||||
| 2063 | \value CubeMapPositiveY Equivalent to GL_TEXTURE_CUBE_MAP_POSITIVE_Y | - | ||||||||||||||||||
| 2064 | \value CubeMapNegativeY Equivalent to GL_TEXTURE_CUBE_MAP_NEGATIVE_Y | - | ||||||||||||||||||
| 2065 | \value CubeMapPositiveZ Equivalent to GL_TEXTURE_CUBE_MAP_POSITIVE_Z | - | ||||||||||||||||||
| 2066 | \value CubeMapNegativeZ Equivalent to GL_TEXTURE_CUBE_MAP_NEGATIVE_Z | - | ||||||||||||||||||
| 2067 | */ | - | ||||||||||||||||||
| 2068 | - | |||||||||||||||||||
| 2069 | /*! | - | ||||||||||||||||||
| 2070 | \enum QOpenGLTexture::PixelFormat | - | ||||||||||||||||||
| 2071 | This enum defines the possible client-side pixel formats for a pixel | - | ||||||||||||||||||
| 2072 | transfer operation. | - | ||||||||||||||||||
| 2073 | - | |||||||||||||||||||
| 2074 | \value NoSourceFormat Equivalent to GL_NONE | - | ||||||||||||||||||
| 2075 | \value Red Equivalent to GL_RED | - | ||||||||||||||||||
| 2076 | \value RG Equivalent to GL_RG | - | ||||||||||||||||||
| 2077 | \value RGB Equivalent to GL_RGB | - | ||||||||||||||||||
| 2078 | \value BGR Equivalent to GL_BGR | - | ||||||||||||||||||
| 2079 | \value RGBA Equivalent to GL_RGBA | - | ||||||||||||||||||
| 2080 | \value BGRA Equivalent to GL_BGRA | - | ||||||||||||||||||
| 2081 | \value Red_Integer Equivalent to GL_RED_INTEGER | - | ||||||||||||||||||
| 2082 | \value RG_Integer Equivalent to GL_RG_INTEGER | - | ||||||||||||||||||
| 2083 | \value RGB_Integer Equivalent to GL_RGB_INTEGER | - | ||||||||||||||||||
| 2084 | \value BGR_Integer Equivalent to GL_BGR_INTEGER | - | ||||||||||||||||||
| 2085 | \value RGBA_Integer Equivalent to GL_RGBA_INTEGER | - | ||||||||||||||||||
| 2086 | \value BGRA_Integer Equivalent to GL_BGRA_INTEGER | - | ||||||||||||||||||
| 2087 | \value Stencil Equivalent to GL_STENCIL_INDEX. Introduced in Qt 5.4 | - | ||||||||||||||||||
| 2088 | \value Depth Equivalent to GL_DEPTH_COMPONENT | - | ||||||||||||||||||
| 2089 | \value DepthStencil Equivalent to GL_DEPTH_STENCIL | - | ||||||||||||||||||
| 2090 | \value Alpha Equivalent to GL_ALPHA (OpenGL ES 2 only) | - | ||||||||||||||||||
| 2091 | \value Luminance Equivalent to GL_LUMINANCE (OpenGL ES 2 only) | - | ||||||||||||||||||
| 2092 | \value LuminanceAlpha Equivalent to GL_LUMINANCE_ALPHA (OpenGL ES 2 only) | - | ||||||||||||||||||
| 2093 | - | |||||||||||||||||||
| 2094 | */ | - | ||||||||||||||||||
| 2095 | - | |||||||||||||||||||
| 2096 | /*! | - | ||||||||||||||||||
| 2097 | \enum QOpenGLTexture::PixelType | - | ||||||||||||||||||
| 2098 | This enum defines the possible pixel data types for a pixel transfer operation | - | ||||||||||||||||||
| 2099 | - | |||||||||||||||||||
| 2100 | \value NoPixelType Equivalent to GL_NONE | - | ||||||||||||||||||
| 2101 | \value Int8 Equivalent to GL_BYTE | - | ||||||||||||||||||
| 2102 | \value UInt8 Equivalent to GL_UNSIGNED_BYTE | - | ||||||||||||||||||
| 2103 | \value Int16 Equivalent to GL_SHORT | - | ||||||||||||||||||
| 2104 | \value UInt16 Equivalent to GL_UNSIGNED_SHORT | - | ||||||||||||||||||
| 2105 | \value Int32 Equivalent to GL_INT | - | ||||||||||||||||||
| 2106 | \value UInt32 Equivalent to GL_UNSIGNED_INT | - | ||||||||||||||||||
| 2107 | \value Float16 Equivalent to GL_HALF_FLOAT | - | ||||||||||||||||||
| 2108 | \value Float16OES Equivalent to GL_HALF_FLOAT_OES | - | ||||||||||||||||||
| 2109 | \value Float32 Equivalent to GL_FLOAT | - | ||||||||||||||||||
| 2110 | \value UInt32_RGB9_E5 Equivalent to GL_UNSIGNED_INT_5_9_9_9_REV | - | ||||||||||||||||||
| 2111 | \value UInt32_RG11B10F Equivalent to GL_UNSIGNED_INT_10F_11F_11F_REV | - | ||||||||||||||||||
| 2112 | \value UInt8_RG3B2 Equivalent to GL_UNSIGNED_BYTE_3_3_2 | - | ||||||||||||||||||
| 2113 | \value UInt8_RG3B2_Rev Equivalent to GL_UNSIGNED_BYTE_2_3_3_REV | - | ||||||||||||||||||
| 2114 | \value UInt16_RGB5A1 Equivalent to GL_UNSIGNED_SHORT_5_5_5_1 | - | ||||||||||||||||||
| 2115 | \value UInt16_RGB5A1_Rev Equivalent to GL_UNSIGNED_SHORT_1_5_5_5_REV | - | ||||||||||||||||||
| 2116 | \value UInt16_R5G6B5 Equivalent to GL_UNSIGNED_SHORT_5_6_5 | - | ||||||||||||||||||
| 2117 | \value UInt16_R5G6B5_Rev Equivalent to GL_UNSIGNED_SHORT_5_6_5_REV | - | ||||||||||||||||||
| 2118 | \value UInt16_RGBA4 Equivalent to GL_UNSIGNED_SHORT_4_4_4_4 | - | ||||||||||||||||||
| 2119 | \value UInt16_RGBA4_Rev Equivalent to GL_UNSIGNED_SHORT_4_4_4_4_REV | - | ||||||||||||||||||
| 2120 | \value UInt32_RGBA8 Equivalent to GL_UNSIGNED_INT_8_8_8_8 | - | ||||||||||||||||||
| 2121 | \value UInt32_RGBA8_Rev Equivalent to GL_UNSIGNED_INT_8_8_8_8_REV | - | ||||||||||||||||||
| 2122 | \value UInt32_RGB10A2 Equivalent to GL_UNSIGNED_INT_10_10_10_2 | - | ||||||||||||||||||
| 2123 | \value UInt32_RGB10A2_Rev Equivalent to GL_UNSIGNED_INT_2_10_10_10_REV | - | ||||||||||||||||||
| 2124 | \value UInt32_D24S8 Equivalent to GL_UNSIGNED_INT_24_8. Introduced in Qt 5.4 | - | ||||||||||||||||||
| 2125 | \value Float32_D32_UInt32_S8_X24 Equivalent to GL_FLOAT_32_UNSIGNED_INT_24_8_REV. Introduced in Qt 5.4 | - | ||||||||||||||||||
| 2126 | */ | - | ||||||||||||||||||
| 2127 | - | |||||||||||||||||||
| 2128 | /*! | - | ||||||||||||||||||
| 2129 | \enum QOpenGLTexture::Feature | - | ||||||||||||||||||
| 2130 | This enum defines the OpenGL texture-related features that can be tested for. | - | ||||||||||||||||||
| 2131 | - | |||||||||||||||||||
| 2132 | \value ImmutableStorage Support for immutable texture storage | - | ||||||||||||||||||
| 2133 | \value ImmutableMultisampleStorage Support for immutable texture storage with | - | ||||||||||||||||||
| 2134 | multisample targets | - | ||||||||||||||||||
| 2135 | \value TextureRectangle Support for the GL_TEXTURE_RECTANGLE target | - | ||||||||||||||||||
| 2136 | \value TextureArrays Support for texture targets with array layers | - | ||||||||||||||||||
| 2137 | \value Texture3D Support for the 3 dimensional texture target | - | ||||||||||||||||||
| 2138 | \value TextureMultisample Support for texture targets that have multisample capabilities | - | ||||||||||||||||||
| 2139 | \value TextureBuffer Support for textures that use OpenGL buffer objects | - | ||||||||||||||||||
| 2140 | as their data source | - | ||||||||||||||||||
| 2141 | \value TextureCubeMapArrays Support for cubemap array texture target | - | ||||||||||||||||||
| 2142 | \value Swizzle Support for texture component swizzle masks | - | ||||||||||||||||||
| 2143 | \value StencilTexturing Support for stencil texturing (i.e. looking up depth or stencil | - | ||||||||||||||||||
| 2144 | components of a combined depth/stencil format texture in GLSL shaders). | - | ||||||||||||||||||
| 2145 | \value AnisotropicFiltering Support for anisotropic texture filtering | - | ||||||||||||||||||
| 2146 | \value NPOTTextures Basic support for non-power-of-two textures | - | ||||||||||||||||||
| 2147 | \value NPOTTextureRepeat Full support for non-power-of-two textures including texture | - | ||||||||||||||||||
| 2148 | repeat modes | - | ||||||||||||||||||
| 2149 | \value Texture1D Support for the 1 dimensional texture target | - | ||||||||||||||||||
| 2150 | \value TextureComparisonOperators Support for texture comparison operators | - | ||||||||||||||||||
| 2151 | \value TextureMipMapLevel Support for setting the base and maximum mipmap levels | - | ||||||||||||||||||
| 2152 | */ | - | ||||||||||||||||||
| 2153 | - | |||||||||||||||||||
| 2154 | /*! | - | ||||||||||||||||||
| 2155 | \enum QOpenGLTexture::SwizzleComponent | - | ||||||||||||||||||
| 2156 | This enum defines the texture color components that can be assigned a swizzle mask. | - | ||||||||||||||||||
| 2157 | - | |||||||||||||||||||
| 2158 | \value SwizzleRed The red component. Equivalent to GL_TEXTURE_SWIZZLE_R | - | ||||||||||||||||||
| 2159 | \value SwizzleGreen The green component. Equivalent to GL_TEXTURE_SWIZZLE_G | - | ||||||||||||||||||
| 2160 | \value SwizzleBlue The blue component. Equivalent to GL_TEXTURE_SWIZZLE_B | - | ||||||||||||||||||
| 2161 | \value SwizzleAlpha The alpha component. Equivalent to GL_TEXTURE_SWIZZLE_A | - | ||||||||||||||||||
| 2162 | */ | - | ||||||||||||||||||
| 2163 | - | |||||||||||||||||||
| 2164 | /*! | - | ||||||||||||||||||
| 2165 | \enum QOpenGLTexture::SwizzleValue | - | ||||||||||||||||||
| 2166 | This enum defines the possible mask values for texture swizzling. | - | ||||||||||||||||||
| 2167 | - | |||||||||||||||||||
| 2168 | \value RedValue Maps the component to the red channel. Equivalent to GL_RED | - | ||||||||||||||||||
| 2169 | \value GreenValue Maps the component to the green channel. Equivalent to GL_GREEN | - | ||||||||||||||||||
| 2170 | \value BlueValue Maps the component to the blue channel. Equivalent to GL_BLUE | - | ||||||||||||||||||
| 2171 | \value AlphaValue Maps the component to the alpha channel. Equivalent to GL_ALPHA | - | ||||||||||||||||||
| 2172 | \value ZeroValue Maps the component to a fixed value of 0. Equivalent to GL_ZERO | - | ||||||||||||||||||
| 2173 | \value OneValue Maps the component to a fixed value of 1. Equivalent to GL_ONE | - | ||||||||||||||||||
| 2174 | */ | - | ||||||||||||||||||
| 2175 | - | |||||||||||||||||||
| 2176 | /*! | - | ||||||||||||||||||
| 2177 | \enum QOpenGLTexture::WrapMode | - | ||||||||||||||||||
| 2178 | This enum defines the possible texture coordinate wrapping modes. | - | ||||||||||||||||||
| 2179 | - | |||||||||||||||||||
| 2180 | \value Repeat Texture coordinate is repeated. Equivalent to GL_REPEAT | - | ||||||||||||||||||
| 2181 | \value MirroredRepeat Texture coordinate is reflected about 0 and 1. Equivalent to GL_MIRRORED_REPEAT | - | ||||||||||||||||||
| 2182 | \value ClampToEdge Clamps the texture coordinates to [0,1]. Equivalent to GL_CLAMP_TO_EDGE | - | ||||||||||||||||||
| 2183 | \value ClampToBorder As for ClampToEdge but also blends samples at 0 and 1 with a | - | ||||||||||||||||||
| 2184 | fixed border color. Equivalent to GL_CLAMP_TO_BORDER | - | ||||||||||||||||||
| 2185 | */ | - | ||||||||||||||||||
| 2186 | - | |||||||||||||||||||
| 2187 | /*! | - | ||||||||||||||||||
| 2188 | \enum QOpenGLTexture::CoordinateDirection | - | ||||||||||||||||||
| 2189 | This enum defines the possible texture coordinate directions | - | ||||||||||||||||||
| 2190 | - | |||||||||||||||||||
| 2191 | \value DirectionS The horizontal direction. Equivalent to GL_TEXTURE_WRAP_S | - | ||||||||||||||||||
| 2192 | \value DirectionT The vertical direction. Equivalent to GL_TEXTURE_WRAP_T | - | ||||||||||||||||||
| 2193 | \value DirectionR The depth direction. Equivalent to GL_TEXTURE_WRAP_R | - | ||||||||||||||||||
| 2194 | */ | - | ||||||||||||||||||
| 2195 | - | |||||||||||||||||||
| 2196 | /*! | - | ||||||||||||||||||
| 2197 | Creates a QOpenGLTexture object that can later be bound to \a target. | - | ||||||||||||||||||
| 2198 | - | |||||||||||||||||||
| 2199 | This does not create the underlying OpenGL texture object. Therefore, | - | ||||||||||||||||||
| 2200 | construction using this constructor does not require a valid current | - | ||||||||||||||||||
| 2201 | OpenGL context. | - | ||||||||||||||||||
| 2202 | */ | - | ||||||||||||||||||
| 2203 | QOpenGLTexture::QOpenGLTexture(Target target) | - | ||||||||||||||||||
| 2204 | : d_ptr(new QOpenGLTexturePrivate(target, this)) | - | ||||||||||||||||||
| 2205 | { | - | ||||||||||||||||||
| 2206 | } never executed: end of block | 0 | ||||||||||||||||||
| 2207 | - | |||||||||||||||||||
| 2208 | /*! | - | ||||||||||||||||||
| 2209 | Creates a QOpenGLTexture object that can later be bound to the 2D texture | - | ||||||||||||||||||
| 2210 | target and contains the pixel data contained in \a image. If you wish | - | ||||||||||||||||||
| 2211 | to have a chain of mipmaps generated then set \a genMipMaps to \c true (this | - | ||||||||||||||||||
| 2212 | is the default). | - | ||||||||||||||||||
| 2213 | - | |||||||||||||||||||
| 2214 | This does create the underlying OpenGL texture object. Therefore, | - | ||||||||||||||||||
| 2215 | construction using this constructor does require a valid current | - | ||||||||||||||||||
| 2216 | OpenGL context. | - | ||||||||||||||||||
| 2217 | */ | - | ||||||||||||||||||
| 2218 | QOpenGLTexture::QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps) | - | ||||||||||||||||||
| 2219 | : d_ptr(new QOpenGLTexturePrivate(QOpenGLTexture::Target2D, this)) | - | ||||||||||||||||||
| 2220 | { | - | ||||||||||||||||||
| 2221 | setData(image, genMipMaps); | - | ||||||||||||||||||
| 2222 | } never executed: end of block | 0 | ||||||||||||||||||
| 2223 | - | |||||||||||||||||||
| 2224 | QOpenGLTexture::~QOpenGLTexture() | - | ||||||||||||||||||
| 2225 | { | - | ||||||||||||||||||
| 2226 | } | - | ||||||||||||||||||
| 2227 | - | |||||||||||||||||||
| 2228 | /*! | - | ||||||||||||||||||
| 2229 | Returns the binding target of this texture. | - | ||||||||||||||||||
| 2230 | - | |||||||||||||||||||
| 2231 | \since 5.4 | - | ||||||||||||||||||
| 2232 | */ | - | ||||||||||||||||||
| 2233 | QOpenGLTexture::Target QOpenGLTexture::target() const | - | ||||||||||||||||||
| 2234 | { | - | ||||||||||||||||||
| 2235 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2236 | return d->target; never executed: return d->target; | 0 | ||||||||||||||||||
| 2237 | } | - | ||||||||||||||||||
| 2238 | - | |||||||||||||||||||
| 2239 | /*! | - | ||||||||||||||||||
| 2240 | Creates the underlying OpenGL texture object. This requires a current valid | - | ||||||||||||||||||
| 2241 | OpenGL context. If the texture object already exists, this function does | - | ||||||||||||||||||
| 2242 | nothing. | - | ||||||||||||||||||
| 2243 | - | |||||||||||||||||||
| 2244 | Once the texture object is created you can obtain the object | - | ||||||||||||||||||
| 2245 | name from the textureId() function. This may be useful if you wish to make | - | ||||||||||||||||||
| 2246 | some raw OpenGL calls related to this texture. | - | ||||||||||||||||||
| 2247 | - | |||||||||||||||||||
| 2248 | Normally it should not be necessary to call this function directly as all | - | ||||||||||||||||||
| 2249 | functions that set properties of the texture object implicitly call create() | - | ||||||||||||||||||
| 2250 | on your behalf. | - | ||||||||||||||||||
| 2251 | - | |||||||||||||||||||
| 2252 | Returns \c true if the creation succeeded, otherwise returns \c false. | - | ||||||||||||||||||
| 2253 | - | |||||||||||||||||||
| 2254 | \sa destroy(), isCreated(), textureId() | - | ||||||||||||||||||
| 2255 | */ | - | ||||||||||||||||||
| 2256 | bool QOpenGLTexture::create() | - | ||||||||||||||||||
| 2257 | { | - | ||||||||||||||||||
| 2258 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2259 | return d->create(); never executed: return d->create(); | 0 | ||||||||||||||||||
| 2260 | } | - | ||||||||||||||||||
| 2261 | - | |||||||||||||||||||
| 2262 | /*! | - | ||||||||||||||||||
| 2263 | Destroys the underlying OpenGL texture object. This requires a current valid | - | ||||||||||||||||||
| 2264 | OpenGL context. | - | ||||||||||||||||||
| 2265 | - | |||||||||||||||||||
| 2266 | \sa create(), isCreated(), textureId() | - | ||||||||||||||||||
| 2267 | */ | - | ||||||||||||||||||
| 2268 | void QOpenGLTexture::destroy() | - | ||||||||||||||||||
| 2269 | { | - | ||||||||||||||||||
| 2270 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2271 | return d->destroy(); never executed: return d->destroy(); | 0 | ||||||||||||||||||
| 2272 | } | - | ||||||||||||||||||
| 2273 | - | |||||||||||||||||||
| 2274 | /*! | - | ||||||||||||||||||
| 2275 | Returns \c true if the underlying OpenGL texture object has been created. | - | ||||||||||||||||||
| 2276 | - | |||||||||||||||||||
| 2277 | \sa create(), destroy(), textureId() | - | ||||||||||||||||||
| 2278 | */ | - | ||||||||||||||||||
| 2279 | bool QOpenGLTexture::isCreated() const | - | ||||||||||||||||||
| 2280 | { | - | ||||||||||||||||||
| 2281 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2282 | return d->textureId != 0; never executed: return d->textureId != 0; | 0 | ||||||||||||||||||
| 2283 | } | - | ||||||||||||||||||
| 2284 | - | |||||||||||||||||||
| 2285 | /*! | - | ||||||||||||||||||
| 2286 | Returns the name of the underlying OpenGL texture object or 0 if it has | - | ||||||||||||||||||
| 2287 | not yet been created. | - | ||||||||||||||||||
| 2288 | - | |||||||||||||||||||
| 2289 | \sa create(), destroy(), isCreated() | - | ||||||||||||||||||
| 2290 | */ | - | ||||||||||||||||||
| 2291 | GLuint QOpenGLTexture::textureId() const | - | ||||||||||||||||||
| 2292 | { | - | ||||||||||||||||||
| 2293 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2294 | return d->textureId; never executed: return d->textureId; | 0 | ||||||||||||||||||
| 2295 | } | - | ||||||||||||||||||
| 2296 | - | |||||||||||||||||||
| 2297 | /*! | - | ||||||||||||||||||
| 2298 | Binds this texture to the currently active texture unit ready for | - | ||||||||||||||||||
| 2299 | rendering. Note that you do not need to bind QOpenGLTexture objects | - | ||||||||||||||||||
| 2300 | in order to modify them as the implementation makes use of the | - | ||||||||||||||||||
| 2301 | EXT_direct_state_access extension where available and simulates it | - | ||||||||||||||||||
| 2302 | where it is not. | - | ||||||||||||||||||
| 2303 | - | |||||||||||||||||||
| 2304 | \sa release() | - | ||||||||||||||||||
| 2305 | */ | - | ||||||||||||||||||
| 2306 | void QOpenGLTexture::bind() | - | ||||||||||||||||||
| 2307 | { | - | ||||||||||||||||||
| 2308 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2309 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 2310 | d->bind(); | - | ||||||||||||||||||
| 2311 | } never executed: end of block | 0 | ||||||||||||||||||
| 2312 | - | |||||||||||||||||||
| 2313 | /*! | - | ||||||||||||||||||
| 2314 | Binds this texture to texture unit \a unit ready for | - | ||||||||||||||||||
| 2315 | rendering. Note that you do not need to bind QOpenGLTexture objects | - | ||||||||||||||||||
| 2316 | in order to modify them as the implementation makes use of the | - | ||||||||||||||||||
| 2317 | EXT_direct_state_access extension where available and simulates it | - | ||||||||||||||||||
| 2318 | where it is not. | - | ||||||||||||||||||
| 2319 | - | |||||||||||||||||||
| 2320 | If parameter \a reset is \c true then this function will restore | - | ||||||||||||||||||
| 2321 | the active unit to the texture unit that was active upon entry. | - | ||||||||||||||||||
| 2322 | - | |||||||||||||||||||
| 2323 | \sa release() | - | ||||||||||||||||||
| 2324 | */ | - | ||||||||||||||||||
| 2325 | void QOpenGLTexture::bind(uint unit, TextureUnitReset reset) | - | ||||||||||||||||||
| 2326 | { | - | ||||||||||||||||||
| 2327 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2328 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 2329 | d->bind(unit, reset); | - | ||||||||||||||||||
| 2330 | } never executed: end of block | 0 | ||||||||||||||||||
| 2331 | - | |||||||||||||||||||
| 2332 | /*! | - | ||||||||||||||||||
| 2333 | Unbinds this texture from the currently active texture unit. | - | ||||||||||||||||||
| 2334 | - | |||||||||||||||||||
| 2335 | \sa bind() | - | ||||||||||||||||||
| 2336 | */ | - | ||||||||||||||||||
| 2337 | void QOpenGLTexture::release() | - | ||||||||||||||||||
| 2338 | { | - | ||||||||||||||||||
| 2339 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2340 | d->release(); | - | ||||||||||||||||||
| 2341 | } never executed: end of block | 0 | ||||||||||||||||||
| 2342 | - | |||||||||||||||||||
| 2343 | /*! | - | ||||||||||||||||||
| 2344 | Unbinds this texture from texture unit \a unit. | - | ||||||||||||||||||
| 2345 | - | |||||||||||||||||||
| 2346 | If parameter \a reset is \c true then this function | - | ||||||||||||||||||
| 2347 | will restore the active unit to the texture unit that was active | - | ||||||||||||||||||
| 2348 | upon entry. | - | ||||||||||||||||||
| 2349 | */ | - | ||||||||||||||||||
| 2350 | void QOpenGLTexture::release(uint unit, TextureUnitReset reset) | - | ||||||||||||||||||
| 2351 | { | - | ||||||||||||||||||
| 2352 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2353 | d->release(unit, reset); | - | ||||||||||||||||||
| 2354 | } never executed: end of block | 0 | ||||||||||||||||||
| 2355 | - | |||||||||||||||||||
| 2356 | /*! | - | ||||||||||||||||||
| 2357 | Returns \c true if this texture is bound to the corresponding target | - | ||||||||||||||||||
| 2358 | of the currently active texture unit. | - | ||||||||||||||||||
| 2359 | - | |||||||||||||||||||
| 2360 | \sa bind(), release() | - | ||||||||||||||||||
| 2361 | */ | - | ||||||||||||||||||
| 2362 | bool QOpenGLTexture::isBound() const | - | ||||||||||||||||||
| 2363 | { | - | ||||||||||||||||||
| 2364 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2365 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 2366 | return d->isBound(); never executed: return d->isBound(); | 0 | ||||||||||||||||||
| 2367 | } | - | ||||||||||||||||||
| 2368 | - | |||||||||||||||||||
| 2369 | /*! | - | ||||||||||||||||||
| 2370 | Returns \c true if this texture is bound to the corresponding target | - | ||||||||||||||||||
| 2371 | of texture unit \a unit. | - | ||||||||||||||||||
| 2372 | - | |||||||||||||||||||
| 2373 | \sa bind(), release() | - | ||||||||||||||||||
| 2374 | */ | - | ||||||||||||||||||
| 2375 | bool QOpenGLTexture::isBound(uint unit) | - | ||||||||||||||||||
| 2376 | { | - | ||||||||||||||||||
| 2377 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2378 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 2379 | return d->isBound(unit); never executed: return d->isBound(unit); | 0 | ||||||||||||||||||
| 2380 | } | - | ||||||||||||||||||
| 2381 | - | |||||||||||||||||||
| 2382 | /*! | - | ||||||||||||||||||
| 2383 | Returns the textureId of the texture that is bound to the \a target | - | ||||||||||||||||||
| 2384 | of the currently active texture unit. | - | ||||||||||||||||||
| 2385 | */ | - | ||||||||||||||||||
| 2386 | GLuint QOpenGLTexture::boundTextureId(BindingTarget target) | - | ||||||||||||||||||
| 2387 | { | - | ||||||||||||||||||
| 2388 | QOpenGLContext *ctx = QOpenGLContext::currentContext(); | - | ||||||||||||||||||
| 2389 | if (!ctx) {
| 0 | ||||||||||||||||||
| 2390 | qWarning("QOpenGLTexture::boundTextureId() requires a valid current context"); | - | ||||||||||||||||||
| 2391 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
| 2392 | } | - | ||||||||||||||||||
| 2393 | - | |||||||||||||||||||
| 2394 | GLint textureId = 0; | - | ||||||||||||||||||
| 2395 | ctx->functions()->glGetIntegerv(target, &textureId); | - | ||||||||||||||||||
| 2396 | return static_cast<GLuint>(textureId); never executed: return static_cast<GLuint>(textureId); | 0 | ||||||||||||||||||
| 2397 | } | - | ||||||||||||||||||
| 2398 | - | |||||||||||||||||||
| 2399 | /*! | - | ||||||||||||||||||
| 2400 | Returns the textureId of the texture that is bound to the \a target | - | ||||||||||||||||||
| 2401 | of the texture unit \a unit. | - | ||||||||||||||||||
| 2402 | */ | - | ||||||||||||||||||
| 2403 | GLuint QOpenGLTexture::boundTextureId(uint unit, BindingTarget target) | - | ||||||||||||||||||
| 2404 | { | - | ||||||||||||||||||
| 2405 | QOpenGLContext *ctx = QOpenGLContext::currentContext(); | - | ||||||||||||||||||
| 2406 | if (!ctx) {
| 0 | ||||||||||||||||||
| 2407 | qWarning("QOpenGLTexture::boundTextureId() requires a valid current context"); | - | ||||||||||||||||||
| 2408 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
| 2409 | } | - | ||||||||||||||||||
| 2410 | - | |||||||||||||||||||
| 2411 | QOpenGLFunctions *funcs = ctx->functions(); | - | ||||||||||||||||||
| 2412 | funcs->initializeOpenGLFunctions(); | - | ||||||||||||||||||
| 2413 | - | |||||||||||||||||||
| 2414 | GLint oldTextureUnit = 0; | - | ||||||||||||||||||
| 2415 | funcs->glGetIntegerv(GL_ACTIVE_TEXTURE, &oldTextureUnit); | - | ||||||||||||||||||
| 2416 | - | |||||||||||||||||||
| 2417 | funcs->glActiveTexture(unit); | - | ||||||||||||||||||
| 2418 | GLint textureId = 0; | - | ||||||||||||||||||
| 2419 | funcs->glGetIntegerv(target, &textureId); | - | ||||||||||||||||||
| 2420 | funcs->glActiveTexture(oldTextureUnit); | - | ||||||||||||||||||
| 2421 | - | |||||||||||||||||||
| 2422 | return static_cast<GLuint>(textureId); never executed: return static_cast<GLuint>(textureId); | 0 | ||||||||||||||||||
| 2423 | } | - | ||||||||||||||||||
| 2424 | - | |||||||||||||||||||
| 2425 | /*! | - | ||||||||||||||||||
| 2426 | Sets the format of this texture object to \a format. This function | - | ||||||||||||||||||
| 2427 | must be called before texture storage is allocated. | - | ||||||||||||||||||
| 2428 | - | |||||||||||||||||||
| 2429 | Note that all formats may not be supported. The exact set of supported | - | ||||||||||||||||||
| 2430 | formats is dependent upon your OpenGL implementation and version. | - | ||||||||||||||||||
| 2431 | - | |||||||||||||||||||
| 2432 | \sa format(), allocateStorage() | - | ||||||||||||||||||
| 2433 | */ | - | ||||||||||||||||||
| 2434 | void QOpenGLTexture::setFormat(TextureFormat format) | - | ||||||||||||||||||
| 2435 | { | - | ||||||||||||||||||
| 2436 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2437 | d->create(); | - | ||||||||||||||||||
| 2438 | if (isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 2439 | qWarning("QOpenGLTexture::setFormat(): Cannot change format once storage has been allocated"); | - | ||||||||||||||||||
| 2440 | return; never executed: return; | 0 | ||||||||||||||||||
| 2441 | } | - | ||||||||||||||||||
| 2442 | - | |||||||||||||||||||
| 2443 | d->format = format; | - | ||||||||||||||||||
| 2444 | - | |||||||||||||||||||
| 2445 | switch (format) { | - | ||||||||||||||||||
| 2446 | case NoFormat: never executed: case NoFormat: | 0 | ||||||||||||||||||
| 2447 | d->formatClass = NoFormatClass; | - | ||||||||||||||||||
| 2448 | break; never executed: break; | 0 | ||||||||||||||||||
| 2449 | - | |||||||||||||||||||
| 2450 | case RGBA32F: never executed: case RGBA32F: | 0 | ||||||||||||||||||
| 2451 | case RGBA32U: never executed: case RGBA32U: | 0 | ||||||||||||||||||
| 2452 | case RGBA32I: never executed: case RGBA32I: | 0 | ||||||||||||||||||
| 2453 | d->formatClass = FormatClass_128Bit; | - | ||||||||||||||||||
| 2454 | break; never executed: break; | 0 | ||||||||||||||||||
| 2455 | - | |||||||||||||||||||
| 2456 | case RGB32F: never executed: case RGB32F: | 0 | ||||||||||||||||||
| 2457 | case RGB32U: never executed: case RGB32U: | 0 | ||||||||||||||||||
| 2458 | case RGB32I: never executed: case RGB32I: | 0 | ||||||||||||||||||
| 2459 | d->formatClass = FormatClass_96Bit; | - | ||||||||||||||||||
| 2460 | break; never executed: break; | 0 | ||||||||||||||||||
| 2461 | - | |||||||||||||||||||
| 2462 | case RGBA16F: never executed: case RGBA16F: | 0 | ||||||||||||||||||
| 2463 | case RG32F: never executed: case RG32F: | 0 | ||||||||||||||||||
| 2464 | case RGBA16U: never executed: case RGBA16U: | 0 | ||||||||||||||||||
| 2465 | case RG32U: never executed: case RG32U: | 0 | ||||||||||||||||||
| 2466 | case RGBA16I: never executed: case RGBA16I: | 0 | ||||||||||||||||||
| 2467 | case RG32I: never executed: case RG32I: | 0 | ||||||||||||||||||
| 2468 | case RGBA16_UNorm: never executed: case RGBA16_UNorm: | 0 | ||||||||||||||||||
| 2469 | case RGBA16_SNorm: never executed: case RGBA16_SNorm: | 0 | ||||||||||||||||||
| 2470 | d->formatClass = FormatClass_64Bit; | - | ||||||||||||||||||
| 2471 | break; never executed: break; | 0 | ||||||||||||||||||
| 2472 | - | |||||||||||||||||||
| 2473 | case RGB16_UNorm: never executed: case RGB16_UNorm: | 0 | ||||||||||||||||||
| 2474 | case RGB16_SNorm: never executed: case RGB16_SNorm: | 0 | ||||||||||||||||||
| 2475 | case RGB16F: never executed: case RGB16F: | 0 | ||||||||||||||||||
| 2476 | case RGB16U: never executed: case RGB16U: | 0 | ||||||||||||||||||
| 2477 | case RGB16I: never executed: case RGB16I: | 0 | ||||||||||||||||||
| 2478 | d->formatClass = FormatClass_48Bit; | - | ||||||||||||||||||
| 2479 | break; never executed: break; | 0 | ||||||||||||||||||
| 2480 | - | |||||||||||||||||||
| 2481 | case RG16F: never executed: case RG16F: | 0 | ||||||||||||||||||
| 2482 | case RG11B10F: never executed: case RG11B10F: | 0 | ||||||||||||||||||
| 2483 | case R32F: never executed: case R32F: | 0 | ||||||||||||||||||
| 2484 | case RGB10A2: never executed: case RGB10A2: | 0 | ||||||||||||||||||
| 2485 | case RGBA8U: never executed: case RGBA8U: | 0 | ||||||||||||||||||
| 2486 | case RG16U: never executed: case RG16U: | 0 | ||||||||||||||||||
| 2487 | case R32U: never executed: case R32U: | 0 | ||||||||||||||||||
| 2488 | case RGBA8I: never executed: case RGBA8I: | 0 | ||||||||||||||||||
| 2489 | case RG16I: never executed: case RG16I: | 0 | ||||||||||||||||||
| 2490 | case R32I: never executed: case R32I: | 0 | ||||||||||||||||||
| 2491 | case RGBA8_UNorm: never executed: case RGBA8_UNorm: | 0 | ||||||||||||||||||
| 2492 | case RG16_UNorm: never executed: case RG16_UNorm: | 0 | ||||||||||||||||||
| 2493 | case RGBA8_SNorm: never executed: case RGBA8_SNorm: | 0 | ||||||||||||||||||
| 2494 | case RG16_SNorm: never executed: case RG16_SNorm: | 0 | ||||||||||||||||||
| 2495 | case SRGB8_Alpha8: never executed: case SRGB8_Alpha8: | 0 | ||||||||||||||||||
| 2496 | case RGB9E5: never executed: case RGB9E5: | 0 | ||||||||||||||||||
| 2497 | d->formatClass = FormatClass_32Bit; | - | ||||||||||||||||||
| 2498 | break; never executed: break; | 0 | ||||||||||||||||||
| 2499 | - | |||||||||||||||||||
| 2500 | case RGB8_UNorm: never executed: case RGB8_UNorm: | 0 | ||||||||||||||||||
| 2501 | case RGB8_SNorm: never executed: case RGB8_SNorm: | 0 | ||||||||||||||||||
| 2502 | case SRGB8: never executed: case SRGB8: | 0 | ||||||||||||||||||
| 2503 | case RGB8U: never executed: case RGB8U: | 0 | ||||||||||||||||||
| 2504 | case RGB8I: never executed: case RGB8I: | 0 | ||||||||||||||||||
| 2505 | d->formatClass = FormatClass_24Bit; | - | ||||||||||||||||||
| 2506 | break; never executed: break; | 0 | ||||||||||||||||||
| 2507 | - | |||||||||||||||||||
| 2508 | case R16F: never executed: case R16F: | 0 | ||||||||||||||||||
| 2509 | case RG8U: never executed: case RG8U: | 0 | ||||||||||||||||||
| 2510 | case R16U: never executed: case R16U: | 0 | ||||||||||||||||||
| 2511 | case RG8I: never executed: case RG8I: | 0 | ||||||||||||||||||
| 2512 | case R16I: never executed: case R16I: | 0 | ||||||||||||||||||
| 2513 | case RG8_UNorm: never executed: case RG8_UNorm: | 0 | ||||||||||||||||||
| 2514 | case R16_UNorm: never executed: case R16_UNorm: | 0 | ||||||||||||||||||
| 2515 | case RG8_SNorm: never executed: case RG8_SNorm: | 0 | ||||||||||||||||||
| 2516 | case R16_SNorm: never executed: case R16_SNorm: | 0 | ||||||||||||||||||
| 2517 | d->formatClass = FormatClass_16Bit; | - | ||||||||||||||||||
| 2518 | break; never executed: break; | 0 | ||||||||||||||||||
| 2519 | - | |||||||||||||||||||
| 2520 | case R8U: never executed: case R8U: | 0 | ||||||||||||||||||
| 2521 | case R8I: never executed: case R8I: | 0 | ||||||||||||||||||
| 2522 | case R8_UNorm: never executed: case R8_UNorm: | 0 | ||||||||||||||||||
| 2523 | case R8_SNorm: never executed: case R8_SNorm: | 0 | ||||||||||||||||||
| 2524 | d->formatClass = FormatClass_8Bit; | - | ||||||||||||||||||
| 2525 | break; never executed: break; | 0 | ||||||||||||||||||
| 2526 | - | |||||||||||||||||||
| 2527 | case R_ATI1N_UNorm: never executed: case R_ATI1N_UNorm: | 0 | ||||||||||||||||||
| 2528 | case R_ATI1N_SNorm: never executed: case R_ATI1N_SNorm: | 0 | ||||||||||||||||||
| 2529 | d->formatClass = FormatClass_RGTC1_R; | - | ||||||||||||||||||
| 2530 | break; never executed: break; | 0 | ||||||||||||||||||
| 2531 | - | |||||||||||||||||||
| 2532 | case RG_ATI2N_UNorm: never executed: case RG_ATI2N_UNorm: | 0 | ||||||||||||||||||
| 2533 | case RG_ATI2N_SNorm: never executed: case RG_ATI2N_SNorm: | 0 | ||||||||||||||||||
| 2534 | d->formatClass = FormatClass_RGTC2_RG; | - | ||||||||||||||||||
| 2535 | break; never executed: break; | 0 | ||||||||||||||||||
| 2536 | - | |||||||||||||||||||
| 2537 | case RGB_BP_UNorm: never executed: case RGB_BP_UNorm: | 0 | ||||||||||||||||||
| 2538 | case SRGB_BP_UNorm: never executed: case SRGB_BP_UNorm: | 0 | ||||||||||||||||||
| 2539 | d->formatClass = FormatClass_BPTC_Unorm; | - | ||||||||||||||||||
| 2540 | break; never executed: break; | 0 | ||||||||||||||||||
| 2541 | - | |||||||||||||||||||
| 2542 | case RGB_BP_UNSIGNED_FLOAT: never executed: case RGB_BP_UNSIGNED_FLOAT: | 0 | ||||||||||||||||||
| 2543 | case RGB_BP_SIGNED_FLOAT: never executed: case RGB_BP_SIGNED_FLOAT: | 0 | ||||||||||||||||||
| 2544 | d->formatClass = FormatClass_BPTC_Float; | - | ||||||||||||||||||
| 2545 | break; never executed: break; | 0 | ||||||||||||||||||
| 2546 | - | |||||||||||||||||||
| 2547 | case RGB_DXT1: never executed: case RGB_DXT1: | 0 | ||||||||||||||||||
| 2548 | case SRGB_DXT1: never executed: case SRGB_DXT1: | 0 | ||||||||||||||||||
| 2549 | d->formatClass = FormatClass_S3TC_DXT1_RGB; | - | ||||||||||||||||||
| 2550 | break; never executed: break; | 0 | ||||||||||||||||||
| 2551 | - | |||||||||||||||||||
| 2552 | case RGBA_DXT1: never executed: case RGBA_DXT1: | 0 | ||||||||||||||||||
| 2553 | case SRGB_Alpha_DXT1: never executed: case SRGB_Alpha_DXT1: | 0 | ||||||||||||||||||
| 2554 | d->formatClass = FormatClass_S3TC_DXT1_RGBA; | - | ||||||||||||||||||
| 2555 | break; never executed: break; | 0 | ||||||||||||||||||
| 2556 | - | |||||||||||||||||||
| 2557 | case RGBA_DXT3: never executed: case RGBA_DXT3: | 0 | ||||||||||||||||||
| 2558 | case SRGB_Alpha_DXT3: never executed: case SRGB_Alpha_DXT3: | 0 | ||||||||||||||||||
| 2559 | d->formatClass = FormatClass_S3TC_DXT3_RGBA; | - | ||||||||||||||||||
| 2560 | break; never executed: break; | 0 | ||||||||||||||||||
| 2561 | - | |||||||||||||||||||
| 2562 | case RGBA_DXT5: never executed: case RGBA_DXT5: | 0 | ||||||||||||||||||
| 2563 | case SRGB_Alpha_DXT5: never executed: case SRGB_Alpha_DXT5: | 0 | ||||||||||||||||||
| 2564 | d->formatClass = FormatClass_S3TC_DXT5_RGBA; | - | ||||||||||||||||||
| 2565 | break; never executed: break; | 0 | ||||||||||||||||||
| 2566 | - | |||||||||||||||||||
| 2567 | case QOpenGLTexture::R11_EAC_UNorm: never executed: case QOpenGLTexture::R11_EAC_UNorm: | 0 | ||||||||||||||||||
| 2568 | case QOpenGLTexture::R11_EAC_SNorm: never executed: case QOpenGLTexture::R11_EAC_SNorm: | 0 | ||||||||||||||||||
| 2569 | case QOpenGLTexture::RG11_EAC_UNorm: never executed: case QOpenGLTexture::RG11_EAC_UNorm: | 0 | ||||||||||||||||||
| 2570 | case QOpenGLTexture::RG11_EAC_SNorm: never executed: case QOpenGLTexture::RG11_EAC_SNorm: | 0 | ||||||||||||||||||
| 2571 | case QOpenGLTexture::RGB8_ETC2: never executed: case QOpenGLTexture::RGB8_ETC2: | 0 | ||||||||||||||||||
| 2572 | case QOpenGLTexture::SRGB8_ETC2: never executed: case QOpenGLTexture::SRGB8_ETC2: | 0 | ||||||||||||||||||
| 2573 | case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 2574 | case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: never executed: case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: | 0 | ||||||||||||||||||
| 2575 | case QOpenGLTexture::RGBA8_ETC2_EAC: never executed: case QOpenGLTexture::RGBA8_ETC2_EAC: | 0 | ||||||||||||||||||
| 2576 | case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: never executed: case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: | 0 | ||||||||||||||||||
| 2577 | case QOpenGLTexture::RGB8_ETC1: never executed: case QOpenGLTexture::RGB8_ETC1: | 0 | ||||||||||||||||||
| 2578 | case RG3B2: never executed: case RG3B2: | 0 | ||||||||||||||||||
| 2579 | case R5G6B5: never executed: case R5G6B5: | 0 | ||||||||||||||||||
| 2580 | case RGB5A1: never executed: case RGB5A1: | 0 | ||||||||||||||||||
| 2581 | case RGBA4: never executed: case RGBA4: | 0 | ||||||||||||||||||
| 2582 | case D16: never executed: case D16: | 0 | ||||||||||||||||||
| 2583 | case D24: never executed: case D24: | 0 | ||||||||||||||||||
| 2584 | case D24S8: never executed: case D24S8: | 0 | ||||||||||||||||||
| 2585 | case D32: never executed: case D32: | 0 | ||||||||||||||||||
| 2586 | case D32F: never executed: case D32F: | 0 | ||||||||||||||||||
| 2587 | case D32FS8X24: never executed: case D32FS8X24: | 0 | ||||||||||||||||||
| 2588 | case S8: never executed: case S8: | 0 | ||||||||||||||||||
| 2589 | case DepthFormat: never executed: case DepthFormat: | 0 | ||||||||||||||||||
| 2590 | case AlphaFormat: never executed: case AlphaFormat: | 0 | ||||||||||||||||||
| 2591 | case RGBFormat: never executed: case RGBFormat: | 0 | ||||||||||||||||||
| 2592 | case RGBAFormat: never executed: case RGBAFormat: | 0 | ||||||||||||||||||
| 2593 | case LuminanceFormat: never executed: case LuminanceFormat: | 0 | ||||||||||||||||||
| 2594 | case LuminanceAlphaFormat: never executed: case LuminanceAlphaFormat: | 0 | ||||||||||||||||||
| 2595 | d->formatClass = FormatClass_Unique; | - | ||||||||||||||||||
| 2596 | break; never executed: break; | 0 | ||||||||||||||||||
| 2597 | } | - | ||||||||||||||||||
| 2598 | } never executed: end of block | 0 | ||||||||||||||||||
| 2599 | - | |||||||||||||||||||
| 2600 | /*! | - | ||||||||||||||||||
| 2601 | Returns the format of this texture object. | - | ||||||||||||||||||
| 2602 | - | |||||||||||||||||||
| 2603 | \sa setFormat() | - | ||||||||||||||||||
| 2604 | */ | - | ||||||||||||||||||
| 2605 | QOpenGLTexture::TextureFormat QOpenGLTexture::format() const | - | ||||||||||||||||||
| 2606 | { | - | ||||||||||||||||||
| 2607 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2608 | return d->format; never executed: return d->format; | 0 | ||||||||||||||||||
| 2609 | } | - | ||||||||||||||||||
| 2610 | - | |||||||||||||||||||
| 2611 | /*! | - | ||||||||||||||||||
| 2612 | Sets the dimensions of this texture object to \a width, | - | ||||||||||||||||||
| 2613 | \a height, and \a depth. The default for each dimension is 1. | - | ||||||||||||||||||
| 2614 | The maximum allowable texture size is dependent upon your OpenGL | - | ||||||||||||||||||
| 2615 | implementation. Allocating storage for a texture less than the | - | ||||||||||||||||||
| 2616 | maximum size can still fail if your system is low on resources. | - | ||||||||||||||||||
| 2617 | - | |||||||||||||||||||
| 2618 | \sa width(), height(), depth() | - | ||||||||||||||||||
| 2619 | */ | - | ||||||||||||||||||
| 2620 | void QOpenGLTexture::setSize(int width, int height, int depth) | - | ||||||||||||||||||
| 2621 | { | - | ||||||||||||||||||
| 2622 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2623 | d->create(); | - | ||||||||||||||||||
| 2624 | if (isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 2625 | qWarning("Cannot resize a texture that already has storage allocated.\n" | - | ||||||||||||||||||
| 2626 | "To do so, destroy() the texture and then create() and setSize()"); | - | ||||||||||||||||||
| 2627 | return; never executed: return; | 0 | ||||||||||||||||||
| 2628 | } | - | ||||||||||||||||||
| 2629 | - | |||||||||||||||||||
| 2630 | switch (d->target) { | - | ||||||||||||||||||
| 2631 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 2632 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 2633 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 2634 | d->dimensions[0] = width; | - | ||||||||||||||||||
| 2635 | Q_UNUSED(height); | - | ||||||||||||||||||
| 2636 | Q_UNUSED(depth); | - | ||||||||||||||||||
| 2637 | break; never executed: break; | 0 | ||||||||||||||||||
| 2638 | - | |||||||||||||||||||
| 2639 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 2640 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 2641 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 2642 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 2643 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 2644 | d->dimensions[0] = width; | - | ||||||||||||||||||
| 2645 | d->dimensions[1] = height; | - | ||||||||||||||||||
| 2646 | Q_UNUSED(depth); | - | ||||||||||||||||||
| 2647 | break; never executed: break; | 0 | ||||||||||||||||||
| 2648 | - | |||||||||||||||||||
| 2649 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 2650 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 2651 | if (width != height)
| 0 | ||||||||||||||||||
| 2652 | qWarning("QAbstractOpenGLTexture::setSize(): Cube map textures must be square"); never executed: QMessageLogger(__FILE__, 2652, __PRETTY_FUNCTION__).warning("QAbstractOpenGLTexture::setSize(): Cube map textures must be square"); | 0 | ||||||||||||||||||
| 2653 | d->dimensions[0] = d->dimensions[1] = width; | - | ||||||||||||||||||
| 2654 | Q_UNUSED(depth); | - | ||||||||||||||||||
| 2655 | break; never executed: break; | 0 | ||||||||||||||||||
| 2656 | - | |||||||||||||||||||
| 2657 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 2658 | d->dimensions[0] = width; | - | ||||||||||||||||||
| 2659 | d->dimensions[1] = height; | - | ||||||||||||||||||
| 2660 | d->dimensions[2] = depth; | - | ||||||||||||||||||
| 2661 | break; never executed: break; | 0 | ||||||||||||||||||
| 2662 | } | - | ||||||||||||||||||
| 2663 | } never executed: end of block | 0 | ||||||||||||||||||
| 2664 | - | |||||||||||||||||||
| 2665 | /*! | - | ||||||||||||||||||
| 2666 | Returns the width of a 1D, 2D or 3D texture. | - | ||||||||||||||||||
| 2667 | - | |||||||||||||||||||
| 2668 | \sa height(), depth(), setSize() | - | ||||||||||||||||||
| 2669 | */ | - | ||||||||||||||||||
| 2670 | int QOpenGLTexture::width() const | - | ||||||||||||||||||
| 2671 | { | - | ||||||||||||||||||
| 2672 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2673 | return d->dimensions[0]; never executed: return d->dimensions[0]; | 0 | ||||||||||||||||||
| 2674 | } | - | ||||||||||||||||||
| 2675 | - | |||||||||||||||||||
| 2676 | /*! | - | ||||||||||||||||||
| 2677 | Returns the height of a 2D or 3D texture. | - | ||||||||||||||||||
| 2678 | - | |||||||||||||||||||
| 2679 | \sa width(), depth(), setSize() | - | ||||||||||||||||||
| 2680 | */ | - | ||||||||||||||||||
| 2681 | int QOpenGLTexture::height() const | - | ||||||||||||||||||
| 2682 | { | - | ||||||||||||||||||
| 2683 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2684 | return d->dimensions[1]; never executed: return d->dimensions[1]; | 0 | ||||||||||||||||||
| 2685 | } | - | ||||||||||||||||||
| 2686 | - | |||||||||||||||||||
| 2687 | /*! | - | ||||||||||||||||||
| 2688 | Returns the depth of a 3D texture. | - | ||||||||||||||||||
| 2689 | - | |||||||||||||||||||
| 2690 | \sa width(), height(), setSize() | - | ||||||||||||||||||
| 2691 | */ | - | ||||||||||||||||||
| 2692 | int QOpenGLTexture::depth() const | - | ||||||||||||||||||
| 2693 | { | - | ||||||||||||||||||
| 2694 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2695 | return d->dimensions[2]; never executed: return d->dimensions[2]; | 0 | ||||||||||||||||||
| 2696 | } | - | ||||||||||||||||||
| 2697 | - | |||||||||||||||||||
| 2698 | /*! | - | ||||||||||||||||||
| 2699 | For texture targets that support mipmaps, this function | - | ||||||||||||||||||
| 2700 | sets the requested number of mipmap \a levels to allocate storage | - | ||||||||||||||||||
| 2701 | for. This function should be called before storage is allocated | - | ||||||||||||||||||
| 2702 | for the texture. | - | ||||||||||||||||||
| 2703 | - | |||||||||||||||||||
| 2704 | If the texture target does not support mipmaps this function | - | ||||||||||||||||||
| 2705 | has no effect. | - | ||||||||||||||||||
| 2706 | - | |||||||||||||||||||
| 2707 | \sa mipLevels(), maximumMipLevels(), isStorageAllocated() | - | ||||||||||||||||||
| 2708 | */ | - | ||||||||||||||||||
| 2709 | void QOpenGLTexture::setMipLevels(int levels) | - | ||||||||||||||||||
| 2710 | { | - | ||||||||||||||||||
| 2711 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2712 | d->create(); | - | ||||||||||||||||||
| 2713 | if (isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 2714 | qWarning("Cannot set mip levels on a texture that already has storage allocated.\n" | - | ||||||||||||||||||
| 2715 | "To do so, destroy() the texture and then create() and setMipLevels()"); | - | ||||||||||||||||||
| 2716 | return; never executed: return; | 0 | ||||||||||||||||||
| 2717 | } | - | ||||||||||||||||||
| 2718 | - | |||||||||||||||||||
| 2719 | switch (d->target) { | - | ||||||||||||||||||
| 2720 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 2721 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 2722 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 2723 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 2724 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 2725 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 2726 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 2727 | d->requestedMipLevels = levels; | - | ||||||||||||||||||
| 2728 | break; never executed: break; | 0 | ||||||||||||||||||
| 2729 | - | |||||||||||||||||||
| 2730 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 2731 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 2732 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 2733 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 2734 | qWarning("QAbstractOpenGLTexture::setMipLevels(): This texture target does not support mipmaps"); | - | ||||||||||||||||||
| 2735 | break; never executed: break; | 0 | ||||||||||||||||||
| 2736 | } | - | ||||||||||||||||||
| 2737 | } never executed: end of block | 0 | ||||||||||||||||||
| 2738 | - | |||||||||||||||||||
| 2739 | /*! | - | ||||||||||||||||||
| 2740 | Returns the number of mipmap levels for this texture. If storage | - | ||||||||||||||||||
| 2741 | has not yet been allocated for this texture it returns the | - | ||||||||||||||||||
| 2742 | requested number of mipmap levels. | - | ||||||||||||||||||
| 2743 | - | |||||||||||||||||||
| 2744 | \sa setMipLevels(), maximumMipLevels(), isStorageAllocated() | - | ||||||||||||||||||
| 2745 | */ | - | ||||||||||||||||||
| 2746 | int QOpenGLTexture::mipLevels() const | - | ||||||||||||||||||
| 2747 | { | - | ||||||||||||||||||
| 2748 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2749 | return isStorageAllocated() ? d->mipLevels : d->requestedMipLevels; never executed: return isStorageAllocated() ? d->mipLevels : d->requestedMipLevels; | 0 | ||||||||||||||||||
| 2750 | } | - | ||||||||||||||||||
| 2751 | - | |||||||||||||||||||
| 2752 | /*! | - | ||||||||||||||||||
| 2753 | Returns the maximum number of mipmap levels that this texture | - | ||||||||||||||||||
| 2754 | can have given the current dimensions. | - | ||||||||||||||||||
| 2755 | - | |||||||||||||||||||
| 2756 | \sa setMipLevels(), mipLevels(), setSize() | - | ||||||||||||||||||
| 2757 | */ | - | ||||||||||||||||||
| 2758 | int QOpenGLTexture::maximumMipLevels() const | - | ||||||||||||||||||
| 2759 | { | - | ||||||||||||||||||
| 2760 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2761 | return d->maximumMipLevelCount(); never executed: return d->maximumMipLevelCount(); | 0 | ||||||||||||||||||
| 2762 | } | - | ||||||||||||||||||
| 2763 | - | |||||||||||||||||||
| 2764 | /*! | - | ||||||||||||||||||
| 2765 | Sets the number of array \a layers to allocate storage for. This | - | ||||||||||||||||||
| 2766 | function should be called before storage is allocated for the texture. | - | ||||||||||||||||||
| 2767 | - | |||||||||||||||||||
| 2768 | For targets that do not support array layers this function has | - | ||||||||||||||||||
| 2769 | no effect. | - | ||||||||||||||||||
| 2770 | - | |||||||||||||||||||
| 2771 | \sa layers(), isStorageAllocated() | - | ||||||||||||||||||
| 2772 | */ | - | ||||||||||||||||||
| 2773 | void QOpenGLTexture::setLayers(int layers) | - | ||||||||||||||||||
| 2774 | { | - | ||||||||||||||||||
| 2775 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2776 | d->create(); | - | ||||||||||||||||||
| 2777 | if (isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 2778 | qWarning("Cannot set layers on a texture that already has storage allocated.\n" | - | ||||||||||||||||||
| 2779 | "To do so, destroy() the texture and then create() and setLayers()"); | - | ||||||||||||||||||
| 2780 | return; never executed: return; | 0 | ||||||||||||||||||
| 2781 | } | - | ||||||||||||||||||
| 2782 | - | |||||||||||||||||||
| 2783 | switch (d->target) { | - | ||||||||||||||||||
| 2784 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 2785 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 2786 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 2787 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 2788 | d->layers = layers; | - | ||||||||||||||||||
| 2789 | break; never executed: break; | 0 | ||||||||||||||||||
| 2790 | - | |||||||||||||||||||
| 2791 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 2792 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 2793 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 2794 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 2795 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 2796 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 2797 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 2798 | qWarning("Texture target does not support array layers"); | - | ||||||||||||||||||
| 2799 | break; never executed: break; | 0 | ||||||||||||||||||
| 2800 | } | - | ||||||||||||||||||
| 2801 | } never executed: end of block | 0 | ||||||||||||||||||
| 2802 | - | |||||||||||||||||||
| 2803 | /*! | - | ||||||||||||||||||
| 2804 | Returns the number of array layers for this texture. If | - | ||||||||||||||||||
| 2805 | storage has not yet been allocated for this texture then | - | ||||||||||||||||||
| 2806 | this function returns the requested number of array layers. | - | ||||||||||||||||||
| 2807 | - | |||||||||||||||||||
| 2808 | For texture targets that do not support array layers this | - | ||||||||||||||||||
| 2809 | will return 1. | - | ||||||||||||||||||
| 2810 | - | |||||||||||||||||||
| 2811 | \sa setLayers(), isStorageAllocated() | - | ||||||||||||||||||
| 2812 | */ | - | ||||||||||||||||||
| 2813 | int QOpenGLTexture::layers() const | - | ||||||||||||||||||
| 2814 | { | - | ||||||||||||||||||
| 2815 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2816 | return d->layers; never executed: return d->layers; | 0 | ||||||||||||||||||
| 2817 | } | - | ||||||||||||||||||
| 2818 | - | |||||||||||||||||||
| 2819 | /*! | - | ||||||||||||||||||
| 2820 | Returns the number of faces for this texture. For cubemap | - | ||||||||||||||||||
| 2821 | and cubemap array type targets this will be 6. | - | ||||||||||||||||||
| 2822 | - | |||||||||||||||||||
| 2823 | For non-cubemap type targets this will return 1. | - | ||||||||||||||||||
| 2824 | */ | - | ||||||||||||||||||
| 2825 | int QOpenGLTexture::faces() const | - | ||||||||||||||||||
| 2826 | { | - | ||||||||||||||||||
| 2827 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2828 | return d->faces; never executed: return d->faces; | 0 | ||||||||||||||||||
| 2829 | } | - | ||||||||||||||||||
| 2830 | - | |||||||||||||||||||
| 2831 | /*! | - | ||||||||||||||||||
| 2832 | Sets the number of \a samples to allocate storage for when rendering to | - | ||||||||||||||||||
| 2833 | a multisample capable texture target. This function should | - | ||||||||||||||||||
| 2834 | be called before storage is allocated for the texture. | - | ||||||||||||||||||
| 2835 | - | |||||||||||||||||||
| 2836 | For targets that do not support multisampling this function has | - | ||||||||||||||||||
| 2837 | no effect. | - | ||||||||||||||||||
| 2838 | - | |||||||||||||||||||
| 2839 | \sa samples(), isStorageAllocated() | - | ||||||||||||||||||
| 2840 | */ | - | ||||||||||||||||||
| 2841 | void QOpenGLTexture::setSamples(int samples) | - | ||||||||||||||||||
| 2842 | { | - | ||||||||||||||||||
| 2843 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2844 | d->create(); | - | ||||||||||||||||||
| 2845 | if (isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 2846 | qWarning("Cannot set sample count on a texture that already has storage allocated.\n" | - | ||||||||||||||||||
| 2847 | "To do so, destroy() the texture and then create() and setSamples()"); | - | ||||||||||||||||||
| 2848 | return; never executed: return; | 0 | ||||||||||||||||||
| 2849 | } | - | ||||||||||||||||||
| 2850 | - | |||||||||||||||||||
| 2851 | switch (d->target) { | - | ||||||||||||||||||
| 2852 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 2853 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 2854 | d->samples = samples; | - | ||||||||||||||||||
| 2855 | break; never executed: break; | 0 | ||||||||||||||||||
| 2856 | - | |||||||||||||||||||
| 2857 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 2858 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 2859 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 2860 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 2861 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 2862 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 2863 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 2864 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 2865 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 2866 | - | |||||||||||||||||||
| 2867 | qWarning("Texture target does not support multisampling"); | - | ||||||||||||||||||
| 2868 | break; never executed: break; | 0 | ||||||||||||||||||
| 2869 | } | - | ||||||||||||||||||
| 2870 | } never executed: end of block | 0 | ||||||||||||||||||
| 2871 | - | |||||||||||||||||||
| 2872 | /*! | - | ||||||||||||||||||
| 2873 | Returns the number of multisample sample points for this texture. | - | ||||||||||||||||||
| 2874 | If storage has not yet been allocated for this texture then | - | ||||||||||||||||||
| 2875 | this function returns the requested number of samples. | - | ||||||||||||||||||
| 2876 | - | |||||||||||||||||||
| 2877 | For texture targets that do not support multisampling this | - | ||||||||||||||||||
| 2878 | will return 0. | - | ||||||||||||||||||
| 2879 | - | |||||||||||||||||||
| 2880 | \sa setSamples(), isStorageAllocated() | - | ||||||||||||||||||
| 2881 | */ | - | ||||||||||||||||||
| 2882 | int QOpenGLTexture::samples() const | - | ||||||||||||||||||
| 2883 | { | - | ||||||||||||||||||
| 2884 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2885 | return d->samples; never executed: return d->samples; | 0 | ||||||||||||||||||
| 2886 | } | - | ||||||||||||||||||
| 2887 | - | |||||||||||||||||||
| 2888 | /*! | - | ||||||||||||||||||
| 2889 | Sets whether the sample positions and number of samples used with | - | ||||||||||||||||||
| 2890 | a multisample capable texture target to \a fixed. If set to \c true | - | ||||||||||||||||||
| 2891 | the sample positions and number of samples used are the same for | - | ||||||||||||||||||
| 2892 | all texels in the image and will not depend upon the image size or | - | ||||||||||||||||||
| 2893 | internal format. This function should be called before storage is allocated | - | ||||||||||||||||||
| 2894 | for the texture. | - | ||||||||||||||||||
| 2895 | - | |||||||||||||||||||
| 2896 | For targets that do not support multisampling this function has | - | ||||||||||||||||||
| 2897 | no effect. | - | ||||||||||||||||||
| 2898 | - | |||||||||||||||||||
| 2899 | The default value is \c true. | - | ||||||||||||||||||
| 2900 | - | |||||||||||||||||||
| 2901 | \sa isFixedSamplePositions(), isStorageAllocated() | - | ||||||||||||||||||
| 2902 | */ | - | ||||||||||||||||||
| 2903 | void QOpenGLTexture::setFixedSamplePositions(bool fixed) | - | ||||||||||||||||||
| 2904 | { | - | ||||||||||||||||||
| 2905 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2906 | d->create(); | - | ||||||||||||||||||
| 2907 | if (isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 2908 | qWarning("Cannot set sample positions on a texture that already has storage allocated.\n" | - | ||||||||||||||||||
| 2909 | "To do so, destroy() the texture and then create() and setFixedSamplePositions()"); | - | ||||||||||||||||||
| 2910 | return; never executed: return; | 0 | ||||||||||||||||||
| 2911 | } | - | ||||||||||||||||||
| 2912 | - | |||||||||||||||||||
| 2913 | switch (d->target) { | - | ||||||||||||||||||
| 2914 | case QOpenGLTexture::Target2DMultisample: never executed: case QOpenGLTexture::Target2DMultisample: | 0 | ||||||||||||||||||
| 2915 | case QOpenGLTexture::Target2DMultisampleArray: never executed: case QOpenGLTexture::Target2DMultisampleArray: | 0 | ||||||||||||||||||
| 2916 | d->fixedSamplePositions = fixed; | - | ||||||||||||||||||
| 2917 | break; never executed: break; | 0 | ||||||||||||||||||
| 2918 | - | |||||||||||||||||||
| 2919 | case QOpenGLTexture::Target1D: never executed: case QOpenGLTexture::Target1D: | 0 | ||||||||||||||||||
| 2920 | case QOpenGLTexture::Target2D: never executed: case QOpenGLTexture::Target2D: | 0 | ||||||||||||||||||
| 2921 | case QOpenGLTexture::Target3D: never executed: case QOpenGLTexture::Target3D: | 0 | ||||||||||||||||||
| 2922 | case QOpenGLTexture::Target1DArray: never executed: case QOpenGLTexture::Target1DArray: | 0 | ||||||||||||||||||
| 2923 | case QOpenGLTexture::Target2DArray: never executed: case QOpenGLTexture::Target2DArray: | 0 | ||||||||||||||||||
| 2924 | case QOpenGLTexture::TargetCubeMap: never executed: case QOpenGLTexture::TargetCubeMap: | 0 | ||||||||||||||||||
| 2925 | case QOpenGLTexture::TargetCubeMapArray: never executed: case QOpenGLTexture::TargetCubeMapArray: | 0 | ||||||||||||||||||
| 2926 | case QOpenGLTexture::TargetBuffer: never executed: case QOpenGLTexture::TargetBuffer: | 0 | ||||||||||||||||||
| 2927 | case QOpenGLTexture::TargetRectangle: never executed: case QOpenGLTexture::TargetRectangle: | 0 | ||||||||||||||||||
| 2928 | - | |||||||||||||||||||
| 2929 | qWarning("Texture target does not support multisampling"); | - | ||||||||||||||||||
| 2930 | break; never executed: break; | 0 | ||||||||||||||||||
| 2931 | } | - | ||||||||||||||||||
| 2932 | } never executed: end of block | 0 | ||||||||||||||||||
| 2933 | - | |||||||||||||||||||
| 2934 | /*! | - | ||||||||||||||||||
| 2935 | Returns whether this texture uses a fixed pattern of multisample | - | ||||||||||||||||||
| 2936 | samples. If storage has not yet been allocated for this texture then | - | ||||||||||||||||||
| 2937 | this function returns the requested fixed sample position setting. | - | ||||||||||||||||||
| 2938 | - | |||||||||||||||||||
| 2939 | For texture targets that do not support multisampling this | - | ||||||||||||||||||
| 2940 | will return \c true. | - | ||||||||||||||||||
| 2941 | - | |||||||||||||||||||
| 2942 | \sa setFixedSamplePositions(), isStorageAllocated() | - | ||||||||||||||||||
| 2943 | */ | - | ||||||||||||||||||
| 2944 | bool QOpenGLTexture::isFixedSamplePositions() const | - | ||||||||||||||||||
| 2945 | { | - | ||||||||||||||||||
| 2946 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 2947 | return d->fixedSamplePositions; never executed: return d->fixedSamplePositions; | 0 | ||||||||||||||||||
| 2948 | } | - | ||||||||||||||||||
| 2949 | - | |||||||||||||||||||
| 2950 | /*! | - | ||||||||||||||||||
| 2951 | Allocates server-side storage for this texture object taking | - | ||||||||||||||||||
| 2952 | into account, the format, dimensions, mipmap levels, array | - | ||||||||||||||||||
| 2953 | layers and cubemap faces. | - | ||||||||||||||||||
| 2954 | - | |||||||||||||||||||
| 2955 | Once storage has been allocated it is no longer possible to change | - | ||||||||||||||||||
| 2956 | these properties. | - | ||||||||||||||||||
| 2957 | - | |||||||||||||||||||
| 2958 | If supported QOpenGLTexture makes use of immutable texture | - | ||||||||||||||||||
| 2959 | storage. | - | ||||||||||||||||||
| 2960 | - | |||||||||||||||||||
| 2961 | Once storage has been allocated for the texture then pixel data | - | ||||||||||||||||||
| 2962 | can be uploaded via one of the setData() overloads. | - | ||||||||||||||||||
| 2963 | - | |||||||||||||||||||
| 2964 | \note If immutable texture storage is not available, | - | ||||||||||||||||||
| 2965 | then a default pixel format and pixel type will be used to | - | ||||||||||||||||||
| 2966 | create the mutable storage. You can use the other | - | ||||||||||||||||||
| 2967 | allocateStorage() overload to specify exactly the pixel format | - | ||||||||||||||||||
| 2968 | and the pixel type to use when allocating mutable storage; | - | ||||||||||||||||||
| 2969 | this is particulary useful under certain OpenGL ES implementations | - | ||||||||||||||||||
| 2970 | (notably, OpenGL ES 2), where the pixel format and the pixel type | - | ||||||||||||||||||
| 2971 | used at allocation time must perfectly match the format | - | ||||||||||||||||||
| 2972 | and the type passed to any subsequent setData() call. | - | ||||||||||||||||||
| 2973 | - | |||||||||||||||||||
| 2974 | \sa isStorageAllocated(), setData() | - | ||||||||||||||||||
| 2975 | */ | - | ||||||||||||||||||
| 2976 | void QOpenGLTexture::allocateStorage() | - | ||||||||||||||||||
| 2977 | { | - | ||||||||||||||||||
| 2978 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 2979 | if (d->create()) {
| 0 | ||||||||||||||||||
| 2980 | const QOpenGLTexture::PixelFormat pixelFormat = pixelFormatCompatibleWithInternalFormat(d->format); | - | ||||||||||||||||||
| 2981 | const QOpenGLTexture::PixelType pixelType = pixelTypeCompatibleWithInternalFormat(d->format); | - | ||||||||||||||||||
| 2982 | d->allocateStorage(pixelFormat, pixelType); | - | ||||||||||||||||||
| 2983 | } never executed: end of block | 0 | ||||||||||||||||||
| 2984 | } never executed: end of block | 0 | ||||||||||||||||||
| 2985 | - | |||||||||||||||||||
| 2986 | /*! | - | ||||||||||||||||||
| 2987 | \since 5.5 | - | ||||||||||||||||||
| 2988 | - | |||||||||||||||||||
| 2989 | Allocates server-side storage for this texture object taking | - | ||||||||||||||||||
| 2990 | into account, the format, dimensions, mipmap levels, array | - | ||||||||||||||||||
| 2991 | layers and cubemap faces. | - | ||||||||||||||||||
| 2992 | - | |||||||||||||||||||
| 2993 | Once storage has been allocated it is no longer possible to change | - | ||||||||||||||||||
| 2994 | these properties. | - | ||||||||||||||||||
| 2995 | - | |||||||||||||||||||
| 2996 | If supported QOpenGLTexture makes use of immutable texture | - | ||||||||||||||||||
| 2997 | storage. However, if immutable texture storage is not available, | - | ||||||||||||||||||
| 2998 | then the specified \a pixelFormat and \a pixelType will be used | - | ||||||||||||||||||
| 2999 | to allocate mutable storage; note that in certain OpenGL implementations | - | ||||||||||||||||||
| 3000 | (notably, OpenGL ES 2) they must perfectly match the format | - | ||||||||||||||||||
| 3001 | and the type passed to any subsequent setData() call. | - | ||||||||||||||||||
| 3002 | - | |||||||||||||||||||
| 3003 | Once storage has been allocated for the texture then pixel data | - | ||||||||||||||||||
| 3004 | can be uploaded via one of the setData() overloads. | - | ||||||||||||||||||
| 3005 | - | |||||||||||||||||||
| 3006 | \sa isStorageAllocated(), setData() | - | ||||||||||||||||||
| 3007 | */ | - | ||||||||||||||||||
| 3008 | void QOpenGLTexture::allocateStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType) | - | ||||||||||||||||||
| 3009 | { | - | ||||||||||||||||||
| 3010 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3011 | if (d->create())
| 0 | ||||||||||||||||||
| 3012 | d->allocateStorage(pixelFormat, pixelType); never executed: d->allocateStorage(pixelFormat, pixelType); | 0 | ||||||||||||||||||
| 3013 | } never executed: end of block | 0 | ||||||||||||||||||
| 3014 | - | |||||||||||||||||||
| 3015 | /*! | - | ||||||||||||||||||
| 3016 | Returns \c true if server-side storage for this texture as been | - | ||||||||||||||||||
| 3017 | allocated. | - | ||||||||||||||||||
| 3018 | - | |||||||||||||||||||
| 3019 | The texture format, dimensions, mipmap levels and array layers | - | ||||||||||||||||||
| 3020 | cannot be altered once storage ihas been allocated. | - | ||||||||||||||||||
| 3021 | - | |||||||||||||||||||
| 3022 | \sa allocateStorage(), setSize(), setMipLevels(), setLayers(), setFormat() | - | ||||||||||||||||||
| 3023 | */ | - | ||||||||||||||||||
| 3024 | bool QOpenGLTexture::isStorageAllocated() const | - | ||||||||||||||||||
| 3025 | { | - | ||||||||||||||||||
| 3026 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3027 | return d->storageAllocated; never executed: return d->storageAllocated; | 0 | ||||||||||||||||||
| 3028 | } | - | ||||||||||||||||||
| 3029 | - | |||||||||||||||||||
| 3030 | /*! | - | ||||||||||||||||||
| 3031 | Attempts to create a texture view onto this texture. A texture | - | ||||||||||||||||||
| 3032 | view is somewhat analogous to a view in SQL in that it presents | - | ||||||||||||||||||
| 3033 | a restricted or reinterpreted view of the original data. Texture | - | ||||||||||||||||||
| 3034 | views do not allocate any more server-side storage, insted relying | - | ||||||||||||||||||
| 3035 | on the storage buffer of the source texture. | - | ||||||||||||||||||
| 3036 | - | |||||||||||||||||||
| 3037 | Texture views are only available when using immutable storage. For | - | ||||||||||||||||||
| 3038 | more information on texture views see | - | ||||||||||||||||||
| 3039 | http://www.opengl.org/wiki/Texture_Storage#Texture_views. | - | ||||||||||||||||||
| 3040 | - | |||||||||||||||||||
| 3041 | The \a target argument specifies the target to use for the view. | - | ||||||||||||||||||
| 3042 | Only some targets can be used depending upon the target of the original | - | ||||||||||||||||||
| 3043 | target. For e.g. a view onto a Target1DArray texture can specify | - | ||||||||||||||||||
| 3044 | either Target1DArray or Target1D but for the latter the number of | - | ||||||||||||||||||
| 3045 | array layers specified with \a minimumLayer and \a maximumLayer must | - | ||||||||||||||||||
| 3046 | be exactly 1. | - | ||||||||||||||||||
| 3047 | - | |||||||||||||||||||
| 3048 | Simpliar constraints apply for the \a viewFormat. See the above link | - | ||||||||||||||||||
| 3049 | and the specification for more details. | - | ||||||||||||||||||
| 3050 | - | |||||||||||||||||||
| 3051 | The \a minimumMipmapLevel, \a maximumMipmapLevel, \a minimumLayer, | - | ||||||||||||||||||
| 3052 | and \a maximumLayer arguments serve to restrict the parts of the | - | ||||||||||||||||||
| 3053 | texture accessible by the texture view. | - | ||||||||||||||||||
| 3054 | - | |||||||||||||||||||
| 3055 | If creation of the texture view fails this function will return | - | ||||||||||||||||||
| 3056 | 0. If the function succeeds it will return a pointer to a new | - | ||||||||||||||||||
| 3057 | QOpenGLTexture object that will return \c true from its isTextureView() | - | ||||||||||||||||||
| 3058 | function. | - | ||||||||||||||||||
| 3059 | - | |||||||||||||||||||
| 3060 | \sa isTextureView() | - | ||||||||||||||||||
| 3061 | */ | - | ||||||||||||||||||
| 3062 | QOpenGLTexture *QOpenGLTexture::createTextureView(Target target, | - | ||||||||||||||||||
| 3063 | TextureFormat viewFormat, | - | ||||||||||||||||||
| 3064 | int minimumMipmapLevel, int maximumMipmapLevel, | - | ||||||||||||||||||
| 3065 | int minimumLayer, int maximumLayer) const | - | ||||||||||||||||||
| 3066 | { | - | ||||||||||||||||||
| 3067 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3068 | if (!isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 3069 | qWarning("Cannot set create a texture view of a texture that does not have storage allocated."); | - | ||||||||||||||||||
| 3070 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
| 3071 | } | - | ||||||||||||||||||
| 3072 | Q_ASSERT(maximumMipmapLevel >= minimumMipmapLevel); | - | ||||||||||||||||||
| 3073 | Q_ASSERT(maximumLayer >= minimumLayer); | - | ||||||||||||||||||
| 3074 | return d->createTextureView(target, viewFormat, never executed: return d->createTextureView(target, viewFormat, minimumMipmapLevel, maximumMipmapLevel, minimumLayer, maximumLayer); | 0 | ||||||||||||||||||
| 3075 | minimumMipmapLevel, maximumMipmapLevel, never executed: return d->createTextureView(target, viewFormat, minimumMipmapLevel, maximumMipmapLevel, minimumLayer, maximumLayer); | 0 | ||||||||||||||||||
| 3076 | minimumLayer, maximumLayer); never executed: return d->createTextureView(target, viewFormat, minimumMipmapLevel, maximumMipmapLevel, minimumLayer, maximumLayer); | 0 | ||||||||||||||||||
| 3077 | } | - | ||||||||||||||||||
| 3078 | - | |||||||||||||||||||
| 3079 | /*! | - | ||||||||||||||||||
| 3080 | Returns \c true if this texture object is actually a view onto another | - | ||||||||||||||||||
| 3081 | texture object. | - | ||||||||||||||||||
| 3082 | - | |||||||||||||||||||
| 3083 | \sa createTextureView() | - | ||||||||||||||||||
| 3084 | */ | - | ||||||||||||||||||
| 3085 | bool QOpenGLTexture::isTextureView() const | - | ||||||||||||||||||
| 3086 | { | - | ||||||||||||||||||
| 3087 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3088 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3089 | return d->textureView; never executed: return d->textureView; | 0 | ||||||||||||||||||
| 3090 | } | - | ||||||||||||||||||
| 3091 | - | |||||||||||||||||||
| 3092 | /*! | - | ||||||||||||||||||
| 3093 | Uploads pixel \a data for this texture object \a mipLevel, array \a layer, and \a cubeFace. | - | ||||||||||||||||||
| 3094 | Storage must have been allocated before uploading pixel data. Some overloads of setData() | - | ||||||||||||||||||
| 3095 | will set appropriate dimensions, mipmap levels, and array layers and then allocate storage | - | ||||||||||||||||||
| 3096 | for you if they have enough information to do so. This will be noted in the function | - | ||||||||||||||||||
| 3097 | documentation. | - | ||||||||||||||||||
| 3098 | - | |||||||||||||||||||
| 3099 | The structure of the pixel data pointed to by \a data is specified by \a sourceFormat | - | ||||||||||||||||||
| 3100 | and \a sourceType. The pixel data upload can optionally be controlled by \a options. | - | ||||||||||||||||||
| 3101 | - | |||||||||||||||||||
| 3102 | If using a compressed format() then you should use setCompressedData() instead of this | - | ||||||||||||||||||
| 3103 | function. | - | ||||||||||||||||||
| 3104 | - | |||||||||||||||||||
| 3105 | \since 5.3 | - | ||||||||||||||||||
| 3106 | \sa setCompressedData() | - | ||||||||||||||||||
| 3107 | */ | - | ||||||||||||||||||
| 3108 | void QOpenGLTexture::setData(int mipLevel, int layer, CubeMapFace cubeFace, | - | ||||||||||||||||||
| 3109 | PixelFormat sourceFormat, PixelType sourceType, | - | ||||||||||||||||||
| 3110 | const void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3111 | { | - | ||||||||||||||||||
| 3112 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3113 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3114 | if (!isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 3115 | qWarning("Cannot set data on a texture that does not have storage allocated.\n" | - | ||||||||||||||||||
| 3116 | "To do so call allocateStorage() before this function"); | - | ||||||||||||||||||
| 3117 | return; never executed: return; | 0 | ||||||||||||||||||
| 3118 | } | - | ||||||||||||||||||
| 3119 | d->setData(mipLevel, layer, cubeFace, sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 3120 | } never executed: end of block | 0 | ||||||||||||||||||
| 3121 | - | |||||||||||||||||||
| 3122 | /*! | - | ||||||||||||||||||
| 3123 | \since 5.3 | - | ||||||||||||||||||
| 3124 | \overload | - | ||||||||||||||||||
| 3125 | */ | - | ||||||||||||||||||
| 3126 | void QOpenGLTexture::setData(int mipLevel, int layer, | - | ||||||||||||||||||
| 3127 | PixelFormat sourceFormat, PixelType sourceType, | - | ||||||||||||||||||
| 3128 | const void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3129 | { | - | ||||||||||||||||||
| 3130 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3131 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3132 | d->setData(mipLevel, layer, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 3133 | } never executed: end of block | 0 | ||||||||||||||||||
| 3134 | - | |||||||||||||||||||
| 3135 | /*! | - | ||||||||||||||||||
| 3136 | \since 5.3 | - | ||||||||||||||||||
| 3137 | \overload | - | ||||||||||||||||||
| 3138 | */ | - | ||||||||||||||||||
| 3139 | void QOpenGLTexture::setData(int mipLevel, | - | ||||||||||||||||||
| 3140 | PixelFormat sourceFormat, PixelType sourceType, | - | ||||||||||||||||||
| 3141 | const void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3142 | { | - | ||||||||||||||||||
| 3143 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3144 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3145 | d->setData(mipLevel, 0, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 3146 | } never executed: end of block | 0 | ||||||||||||||||||
| 3147 | - | |||||||||||||||||||
| 3148 | /*! | - | ||||||||||||||||||
| 3149 | \since 5.3 | - | ||||||||||||||||||
| 3150 | \overload | - | ||||||||||||||||||
| 3151 | */ | - | ||||||||||||||||||
| 3152 | void QOpenGLTexture::setData(PixelFormat sourceFormat, PixelType sourceType, | - | ||||||||||||||||||
| 3153 | const void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3154 | { | - | ||||||||||||||||||
| 3155 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3156 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3157 | d->setData(0, 0, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 3158 | } never executed: end of block | 0 | ||||||||||||||||||
| 3159 | - | |||||||||||||||||||
| 3160 | #if QT_DEPRECATED_SINCE(5, 3) | - | ||||||||||||||||||
| 3161 | /*! | - | ||||||||||||||||||
| 3162 | \obsolete | - | ||||||||||||||||||
| 3163 | \overload | - | ||||||||||||||||||
| 3164 | - | |||||||||||||||||||
| 3165 | \sa setCompressedData() | - | ||||||||||||||||||
| 3166 | */ | - | ||||||||||||||||||
| 3167 | void QOpenGLTexture::setData(int mipLevel, int layer, CubeMapFace cubeFace, | - | ||||||||||||||||||
| 3168 | PixelFormat sourceFormat, PixelType sourceType, | - | ||||||||||||||||||
| 3169 | void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3170 | { | - | ||||||||||||||||||
| 3171 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3172 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3173 | if (!isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 3174 | qWarning("Cannot set data on a texture that does not have storage allocated.\n" | - | ||||||||||||||||||
| 3175 | "To do so call allocateStorage() before this function"); | - | ||||||||||||||||||
| 3176 | return; never executed: return; | 0 | ||||||||||||||||||
| 3177 | } | - | ||||||||||||||||||
| 3178 | d->setData(mipLevel, layer, cubeFace, sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 3179 | } never executed: end of block | 0 | ||||||||||||||||||
| 3180 | - | |||||||||||||||||||
| 3181 | /*! | - | ||||||||||||||||||
| 3182 | \obsolete | - | ||||||||||||||||||
| 3183 | \overload | - | ||||||||||||||||||
| 3184 | */ | - | ||||||||||||||||||
| 3185 | void QOpenGLTexture::setData(int mipLevel, int layer, | - | ||||||||||||||||||
| 3186 | PixelFormat sourceFormat, PixelType sourceType, | - | ||||||||||||||||||
| 3187 | void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3188 | { | - | ||||||||||||||||||
| 3189 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3190 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3191 | d->setData(mipLevel, layer, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 3192 | } never executed: end of block | 0 | ||||||||||||||||||
| 3193 | - | |||||||||||||||||||
| 3194 | /*! | - | ||||||||||||||||||
| 3195 | \obsolete | - | ||||||||||||||||||
| 3196 | \overload | - | ||||||||||||||||||
| 3197 | */ | - | ||||||||||||||||||
| 3198 | void QOpenGLTexture::setData(int mipLevel, | - | ||||||||||||||||||
| 3199 | PixelFormat sourceFormat, PixelType sourceType, | - | ||||||||||||||||||
| 3200 | void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3201 | { | - | ||||||||||||||||||
| 3202 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3203 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3204 | d->setData(mipLevel, 0, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 3205 | } never executed: end of block | 0 | ||||||||||||||||||
| 3206 | - | |||||||||||||||||||
| 3207 | /*! | - | ||||||||||||||||||
| 3208 | \obsolete | - | ||||||||||||||||||
| 3209 | \overload | - | ||||||||||||||||||
| 3210 | */ | - | ||||||||||||||||||
| 3211 | void QOpenGLTexture::setData(PixelFormat sourceFormat, PixelType sourceType, | - | ||||||||||||||||||
| 3212 | void *data, const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3213 | { | - | ||||||||||||||||||
| 3214 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3215 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3216 | d->setData(0, 0, QOpenGLTexture::CubeMapPositiveX, sourceFormat, sourceType, data, options); | - | ||||||||||||||||||
| 3217 | } never executed: end of block | 0 | ||||||||||||||||||
| 3218 | #endif | - | ||||||||||||||||||
| 3219 | - | |||||||||||||||||||
| 3220 | /*! | - | ||||||||||||||||||
| 3221 | This overload of setData() will allocate storage for you. | - | ||||||||||||||||||
| 3222 | The pixel data is contained in \a image. Mipmaps are generated by default. | - | ||||||||||||||||||
| 3223 | Set \a genMipMaps to \l DontGenerateMipMaps to turn off mipmap generation. | - | ||||||||||||||||||
| 3224 | - | |||||||||||||||||||
| 3225 | \overload | - | ||||||||||||||||||
| 3226 | */ | - | ||||||||||||||||||
| 3227 | void QOpenGLTexture::setData(const QImage& image, MipMapGeneration genMipMaps) | - | ||||||||||||||||||
| 3228 | { | - | ||||||||||||||||||
| 3229 | QOpenGLContext *context = QOpenGLContext::currentContext(); | - | ||||||||||||||||||
| 3230 | if (!context) {
| 0 | ||||||||||||||||||
| 3231 | qWarning("QOpenGLTexture::setData() requires a valid current context"); | - | ||||||||||||||||||
| 3232 | return; never executed: return; | 0 | ||||||||||||||||||
| 3233 | } | - | ||||||||||||||||||
| 3234 | - | |||||||||||||||||||
| 3235 | if (image.isNull()) {
| 0 | ||||||||||||||||||
| 3236 | qWarning("QOpenGLTexture::setData() tried to set a null image"); | - | ||||||||||||||||||
| 3237 | return; never executed: return; | 0 | ||||||||||||||||||
| 3238 | } | - | ||||||||||||||||||
| 3239 | - | |||||||||||||||||||
| 3240 | if (context->isOpenGLES() && context->format().majorVersion() < 3)
| 0 | ||||||||||||||||||
| 3241 | setFormat(QOpenGLTexture::RGBAFormat); never executed: setFormat(QOpenGLTexture::RGBAFormat); | 0 | ||||||||||||||||||
| 3242 | else | - | ||||||||||||||||||
| 3243 | setFormat(QOpenGLTexture::RGBA8_UNorm); never executed: setFormat(QOpenGLTexture::RGBA8_UNorm); | 0 | ||||||||||||||||||
| 3244 | - | |||||||||||||||||||
| 3245 | setSize(image.width(), image.height()); | - | ||||||||||||||||||
| 3246 | setMipLevels(genMipMaps == GenerateMipMaps ? maximumMipLevels() : 1); | - | ||||||||||||||||||
| 3247 | allocateStorage(QOpenGLTexture::RGBA, QOpenGLTexture::UInt8); | - | ||||||||||||||||||
| 3248 | - | |||||||||||||||||||
| 3249 | // Upload pixel data and generate mipmaps | - | ||||||||||||||||||
| 3250 | QImage glImage = image.convertToFormat(QImage::Format_RGBA8888); | - | ||||||||||||||||||
| 3251 | QOpenGLPixelTransferOptions uploadOptions; | - | ||||||||||||||||||
| 3252 | uploadOptions.setAlignment(1); | - | ||||||||||||||||||
| 3253 | setData(0, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, glImage.constBits(), &uploadOptions); | - | ||||||||||||||||||
| 3254 | } never executed: end of block | 0 | ||||||||||||||||||
| 3255 | - | |||||||||||||||||||
| 3256 | /*! | - | ||||||||||||||||||
| 3257 | Uploads compressed pixel \a data to \a mipLevel, array \a layer, and \a cubeFace. | - | ||||||||||||||||||
| 3258 | The pixel transfer can optionally be controlled with \a options. The \a dataSize | - | ||||||||||||||||||
| 3259 | argument should specify the size of the data pointed to by \a data. | - | ||||||||||||||||||
| 3260 | - | |||||||||||||||||||
| 3261 | If not using a compressed format() then you should use setData() instead of this | - | ||||||||||||||||||
| 3262 | function. | - | ||||||||||||||||||
| 3263 | - | |||||||||||||||||||
| 3264 | \since 5.3 | - | ||||||||||||||||||
| 3265 | */ | - | ||||||||||||||||||
| 3266 | void QOpenGLTexture::setCompressedData(int mipLevel, int layer, CubeMapFace cubeFace, | - | ||||||||||||||||||
| 3267 | int dataSize, const void *data, | - | ||||||||||||||||||
| 3268 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3269 | { | - | ||||||||||||||||||
| 3270 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3271 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3272 | if (!isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 3273 | qWarning("Cannot set data on a texture that does not have storage allocated.\n" | - | ||||||||||||||||||
| 3274 | "To do so call allocateStorage() before this function"); | - | ||||||||||||||||||
| 3275 | return; never executed: return; | 0 | ||||||||||||||||||
| 3276 | } | - | ||||||||||||||||||
| 3277 | d->setCompressedData(mipLevel, layer, cubeFace, dataSize, data, options); | - | ||||||||||||||||||
| 3278 | } never executed: end of block | 0 | ||||||||||||||||||
| 3279 | - | |||||||||||||||||||
| 3280 | /*! | - | ||||||||||||||||||
| 3281 | \overload | - | ||||||||||||||||||
| 3282 | */ | - | ||||||||||||||||||
| 3283 | void QOpenGLTexture::setCompressedData(int mipLevel, int layer, int dataSize, const void *data, | - | ||||||||||||||||||
| 3284 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3285 | { | - | ||||||||||||||||||
| 3286 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3287 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3288 | d->setCompressedData(mipLevel, layer, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options); | - | ||||||||||||||||||
| 3289 | } never executed: end of block | 0 | ||||||||||||||||||
| 3290 | - | |||||||||||||||||||
| 3291 | /*! | - | ||||||||||||||||||
| 3292 | \overload | - | ||||||||||||||||||
| 3293 | */ | - | ||||||||||||||||||
| 3294 | void QOpenGLTexture::setCompressedData(int mipLevel, int dataSize, const void *data, | - | ||||||||||||||||||
| 3295 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3296 | { | - | ||||||||||||||||||
| 3297 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3298 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3299 | d->setCompressedData(mipLevel, 0, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options); | - | ||||||||||||||||||
| 3300 | } never executed: end of block | 0 | ||||||||||||||||||
| 3301 | - | |||||||||||||||||||
| 3302 | /*! | - | ||||||||||||||||||
| 3303 | \overload | - | ||||||||||||||||||
| 3304 | */ | - | ||||||||||||||||||
| 3305 | void QOpenGLTexture::setCompressedData(int dataSize, const void *data, | - | ||||||||||||||||||
| 3306 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3307 | { | - | ||||||||||||||||||
| 3308 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3309 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3310 | d->setCompressedData(0, 0, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options); | - | ||||||||||||||||||
| 3311 | } never executed: end of block | 0 | ||||||||||||||||||
| 3312 | - | |||||||||||||||||||
| 3313 | #if QT_DEPRECATED_SINCE(5, 3) | - | ||||||||||||||||||
| 3314 | /*! | - | ||||||||||||||||||
| 3315 | \obsolete | - | ||||||||||||||||||
| 3316 | \overload | - | ||||||||||||||||||
| 3317 | */ | - | ||||||||||||||||||
| 3318 | void QOpenGLTexture::setCompressedData(int mipLevel, int layer, CubeMapFace cubeFace, | - | ||||||||||||||||||
| 3319 | int dataSize, void *data, | - | ||||||||||||||||||
| 3320 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3321 | { | - | ||||||||||||||||||
| 3322 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3323 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3324 | if (!isStorageAllocated()) {
| 0 | ||||||||||||||||||
| 3325 | qWarning("Cannot set data on a texture that does not have storage allocated.\n" | - | ||||||||||||||||||
| 3326 | "To do so call allocateStorage() before this function"); | - | ||||||||||||||||||
| 3327 | return; never executed: return; | 0 | ||||||||||||||||||
| 3328 | } | - | ||||||||||||||||||
| 3329 | d->setCompressedData(mipLevel, layer, cubeFace, dataSize, data, options); | - | ||||||||||||||||||
| 3330 | } never executed: end of block | 0 | ||||||||||||||||||
| 3331 | - | |||||||||||||||||||
| 3332 | /*! | - | ||||||||||||||||||
| 3333 | \obsolete | - | ||||||||||||||||||
| 3334 | \overload | - | ||||||||||||||||||
| 3335 | */ | - | ||||||||||||||||||
| 3336 | void QOpenGLTexture::setCompressedData(int mipLevel, int layer, int dataSize, void *data, | - | ||||||||||||||||||
| 3337 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3338 | { | - | ||||||||||||||||||
| 3339 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3340 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3341 | d->setCompressedData(mipLevel, layer, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options); | - | ||||||||||||||||||
| 3342 | } never executed: end of block | 0 | ||||||||||||||||||
| 3343 | - | |||||||||||||||||||
| 3344 | /*! | - | ||||||||||||||||||
| 3345 | \obsolete | - | ||||||||||||||||||
| 3346 | \overload | - | ||||||||||||||||||
| 3347 | */ | - | ||||||||||||||||||
| 3348 | void QOpenGLTexture::setCompressedData(int mipLevel, int dataSize, void *data, | - | ||||||||||||||||||
| 3349 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3350 | { | - | ||||||||||||||||||
| 3351 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3352 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3353 | d->setCompressedData(mipLevel, 0, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options); | - | ||||||||||||||||||
| 3354 | } never executed: end of block | 0 | ||||||||||||||||||
| 3355 | - | |||||||||||||||||||
| 3356 | /*! | - | ||||||||||||||||||
| 3357 | \obsolete | - | ||||||||||||||||||
| 3358 | \overload | - | ||||||||||||||||||
| 3359 | */ | - | ||||||||||||||||||
| 3360 | void QOpenGLTexture::setCompressedData(int dataSize, void *data, | - | ||||||||||||||||||
| 3361 | const QOpenGLPixelTransferOptions * const options) | - | ||||||||||||||||||
| 3362 | { | - | ||||||||||||||||||
| 3363 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3364 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3365 | d->setCompressedData(0, 0, QOpenGLTexture::CubeMapPositiveX, dataSize, data, options); | - | ||||||||||||||||||
| 3366 | } never executed: end of block | 0 | ||||||||||||||||||
| 3367 | #endif | - | ||||||||||||||||||
| 3368 | - | |||||||||||||||||||
| 3369 | /*! | - | ||||||||||||||||||
| 3370 | Returns \c true if your OpenGL implementation and version supports the texture | - | ||||||||||||||||||
| 3371 | feature \a feature. | - | ||||||||||||||||||
| 3372 | */ | - | ||||||||||||||||||
| 3373 | bool QOpenGLTexture::hasFeature(Feature feature) | - | ||||||||||||||||||
| 3374 | { | - | ||||||||||||||||||
| 3375 | QOpenGLContext *ctx = QOpenGLContext::currentContext(); | - | ||||||||||||||||||
| 3376 | if (!ctx) {
| 0 | ||||||||||||||||||
| 3377 | qWarning("QOpenGLTexture::hasFeature() requires a valid current context"); | - | ||||||||||||||||||
| 3378 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 3379 | } | - | ||||||||||||||||||
| 3380 | - | |||||||||||||||||||
| 3381 | QSurfaceFormat f = ctx->format(); | - | ||||||||||||||||||
| 3382 | - | |||||||||||||||||||
| 3383 | bool supported = false; | - | ||||||||||||||||||
| 3384 | - | |||||||||||||||||||
| 3385 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 3386 | if (!ctx->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 3387 | switch (feature) { | - | ||||||||||||||||||
| 3388 | case ImmutableMultisampleStorage: never executed: case ImmutableMultisampleStorage: | 0 | ||||||||||||||||||
| 3389 | supported = f.version() >= qMakePair(4, 3)
| 0 | ||||||||||||||||||
| 3390 | || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_storage_multisample")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3391 | break; never executed: break; | 0 | ||||||||||||||||||
| 3392 | - | |||||||||||||||||||
| 3393 | case TextureBuffer: never executed: case TextureBuffer: | 0 | ||||||||||||||||||
| 3394 | supported = f.version() >= qMakePair(3, 0)
| 0 | ||||||||||||||||||
| 3395 | || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_buffer_object")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3396 | break; never executed: break; | 0 | ||||||||||||||||||
| 3397 | - | |||||||||||||||||||
| 3398 | case StencilTexturing: never executed: case StencilTexturing: | 0 | ||||||||||||||||||
| 3399 | supported = f.version() >= qMakePair(4, 3)
| 0 | ||||||||||||||||||
| 3400 | || ctx->hasExtension(QByteArrayLiteral("GL_ARB_stencil_texturing")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3401 | break; never executed: break; | 0 | ||||||||||||||||||
| 3402 | - | |||||||||||||||||||
| 3403 | case ImmutableStorage: never executed: case ImmutableStorage: | 0 | ||||||||||||||||||
| 3404 | supported = f.version() >= qMakePair(4, 2)
| 0 | ||||||||||||||||||
| 3405 | || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_storage")) never executed: return ba;
| 0 | ||||||||||||||||||
| 3406 | || ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_storage")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3407 | break; never executed: break; | 0 | ||||||||||||||||||
| 3408 | - | |||||||||||||||||||
| 3409 | case TextureCubeMapArrays: never executed: case TextureCubeMapArrays: | 0 | ||||||||||||||||||
| 3410 | supported = f.version() >= qMakePair(4, 0)
| 0 | ||||||||||||||||||
| 3411 | || ctx->hasExtension(QByteArrayLiteral("ARB_texture_cube_map_array")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3412 | break; never executed: break; | 0 | ||||||||||||||||||
| 3413 | - | |||||||||||||||||||
| 3414 | case Swizzle: never executed: case Swizzle: | 0 | ||||||||||||||||||
| 3415 | supported = f.version() >= qMakePair(3, 3)
| 0 | ||||||||||||||||||
| 3416 | || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_swizzle")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3417 | break; never executed: break; | 0 | ||||||||||||||||||
| 3418 | - | |||||||||||||||||||
| 3419 | case TextureMultisample: never executed: case TextureMultisample: | 0 | ||||||||||||||||||
| 3420 | supported = f.version() >= qMakePair(3, 2)
| 0 | ||||||||||||||||||
| 3421 | || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_multisample")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3422 | break; never executed: break; | 0 | ||||||||||||||||||
| 3423 | - | |||||||||||||||||||
| 3424 | case TextureArrays: never executed: case TextureArrays: | 0 | ||||||||||||||||||
| 3425 | supported = f.version() >= qMakePair(3, 0)
| 0 | ||||||||||||||||||
| 3426 | || ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_array")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3427 | break; never executed: break; | 0 | ||||||||||||||||||
| 3428 | - | |||||||||||||||||||
| 3429 | case TextureRectangle: never executed: case TextureRectangle: | 0 | ||||||||||||||||||
| 3430 | supported = f.version() >= qMakePair(2, 1)
| 0 | ||||||||||||||||||
| 3431 | || ctx->hasExtension(QByteArrayLiteral("ARB_texture_rectangle")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3432 | break; never executed: break; | 0 | ||||||||||||||||||
| 3433 | - | |||||||||||||||||||
| 3434 | case Texture3D: never executed: case Texture3D: | 0 | ||||||||||||||||||
| 3435 | supported = f.version() >= qMakePair(1, 3); | - | ||||||||||||||||||
| 3436 | break; never executed: break; | 0 | ||||||||||||||||||
| 3437 | - | |||||||||||||||||||
| 3438 | case AnisotropicFiltering: never executed: case AnisotropicFiltering: | 0 | ||||||||||||||||||
| 3439 | supported = ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_filter_anisotropic")); never executed: return ba; | 0 | ||||||||||||||||||
| 3440 | break; never executed: break; | 0 | ||||||||||||||||||
| 3441 | - | |||||||||||||||||||
| 3442 | case NPOTTextures: never executed: case NPOTTextures: | 0 | ||||||||||||||||||
| 3443 | case NPOTTextureRepeat: never executed: case NPOTTextureRepeat: | 0 | ||||||||||||||||||
| 3444 | supported = ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_non_power_of_two")); never executed: return ba; | 0 | ||||||||||||||||||
| 3445 | break; never executed: break; | 0 | ||||||||||||||||||
| 3446 | - | |||||||||||||||||||
| 3447 | case Texture1D: never executed: case Texture1D: | 0 | ||||||||||||||||||
| 3448 | supported = f.version() >= qMakePair(1, 1); | - | ||||||||||||||||||
| 3449 | break; never executed: break; | 0 | ||||||||||||||||||
| 3450 | - | |||||||||||||||||||
| 3451 | case TextureComparisonOperators: never executed: case TextureComparisonOperators: | 0 | ||||||||||||||||||
| 3452 | // GL 1.4 and GL_ARB_shadow alone support only LEQUAL and GEQUAL; | - | ||||||||||||||||||
| 3453 | // since we're talking about history anyhow avoid to be extra pedantic | - | ||||||||||||||||||
| 3454 | // in the feature set, and simply claim supported if we have the full set of operators | - | ||||||||||||||||||
| 3455 | // (which has been added into 1.5 / GL_EXT_shadow_funcs). | - | ||||||||||||||||||
| 3456 | supported = f.version() >= qMakePair(1, 5)
| 0 | ||||||||||||||||||
| 3457 | || (ctx->hasExtension(QByteArrayLiteral("GL_ARB_shadow")) never executed: return ba;
| 0 | ||||||||||||||||||
| 3458 | && ctx->hasExtension(QByteArrayLiteral("GL_EXT_shadow_funcs"))); never executed: return ba;
| 0 | ||||||||||||||||||
| 3459 | break; never executed: break; | 0 | ||||||||||||||||||
| 3460 | - | |||||||||||||||||||
| 3461 | case TextureMipMapLevel: never executed: case TextureMipMapLevel: | 0 | ||||||||||||||||||
| 3462 | supported = f.version() >= qMakePair(1, 2); | - | ||||||||||||||||||
| 3463 | break; never executed: break; | 0 | ||||||||||||||||||
| 3464 | - | |||||||||||||||||||
| 3465 | case MaxFeatureFlag: never executed: case MaxFeatureFlag: | 0 | ||||||||||||||||||
| 3466 | break; never executed: break; | 0 | ||||||||||||||||||
| 3467 | } | - | ||||||||||||||||||
| 3468 | } never executed: end of block | 0 | ||||||||||||||||||
| 3469 | - | |||||||||||||||||||
| 3470 | if (ctx->isOpenGLES())
| 0 | ||||||||||||||||||
| 3471 | #endif | - | ||||||||||||||||||
| 3472 | { | - | ||||||||||||||||||
| 3473 | const char *renderer = reinterpret_cast<const char *>(ctx->functions()->glGetString(GL_RENDERER)); | - | ||||||||||||||||||
| 3474 | switch (feature) { | - | ||||||||||||||||||
| 3475 | case ImmutableStorage: never executed: case ImmutableStorage: | 0 | ||||||||||||||||||
| 3476 | supported = (f.version() >= qMakePair(3, 0) || ctx->hasExtension(QByteArrayLiteral("EXT_texture_storage"))) never executed: return ba;
| 0 | ||||||||||||||||||
| 3477 | && !(renderer && strstr(renderer, "Mali")); // do not use on Mali: QTBUG-45106
| 0 | ||||||||||||||||||
| 3478 | break; never executed: break; | 0 | ||||||||||||||||||
| 3479 | - | |||||||||||||||||||
| 3480 | case ImmutableMultisampleStorage: never executed: case ImmutableMultisampleStorage: | 0 | ||||||||||||||||||
| 3481 | supported = f.version() >= qMakePair(3, 1); | - | ||||||||||||||||||
| 3482 | break; never executed: break; | 0 | ||||||||||||||||||
| 3483 | - | |||||||||||||||||||
| 3484 | case TextureRectangle: never executed: case TextureRectangle: | 0 | ||||||||||||||||||
| 3485 | break; never executed: break; | 0 | ||||||||||||||||||
| 3486 | - | |||||||||||||||||||
| 3487 | case TextureArrays: never executed: case TextureArrays: | 0 | ||||||||||||||||||
| 3488 | supported = f.version() >= qMakePair(3, 0); | - | ||||||||||||||||||
| 3489 | break; never executed: break; | 0 | ||||||||||||||||||
| 3490 | - | |||||||||||||||||||
| 3491 | case Texture3D: never executed: case Texture3D: | 0 | ||||||||||||||||||
| 3492 | supported = f.version() >= qMakePair(3, 0)
| 0 | ||||||||||||||||||
| 3493 | || ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_3D")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3494 | break; never executed: break; | 0 | ||||||||||||||||||
| 3495 | - | |||||||||||||||||||
| 3496 | case TextureMultisample: never executed: case TextureMultisample: | 0 | ||||||||||||||||||
| 3497 | supported = f.version() >= qMakePair(3, 1); | - | ||||||||||||||||||
| 3498 | break; never executed: break; | 0 | ||||||||||||||||||
| 3499 | - | |||||||||||||||||||
| 3500 | case TextureBuffer: never executed: case TextureBuffer: | 0 | ||||||||||||||||||
| 3501 | break; never executed: break; | 0 | ||||||||||||||||||
| 3502 | - | |||||||||||||||||||
| 3503 | case TextureCubeMapArrays: never executed: case TextureCubeMapArrays: | 0 | ||||||||||||||||||
| 3504 | break; never executed: break; | 0 | ||||||||||||||||||
| 3505 | - | |||||||||||||||||||
| 3506 | case Swizzle: never executed: case Swizzle: | 0 | ||||||||||||||||||
| 3507 | supported = f.version() >= qMakePair(3, 0); | - | ||||||||||||||||||
| 3508 | break; never executed: break; | 0 | ||||||||||||||||||
| 3509 | - | |||||||||||||||||||
| 3510 | case StencilTexturing: never executed: case StencilTexturing: | 0 | ||||||||||||||||||
| 3511 | break; never executed: break; | 0 | ||||||||||||||||||
| 3512 | - | |||||||||||||||||||
| 3513 | case AnisotropicFiltering: never executed: case AnisotropicFiltering: | 0 | ||||||||||||||||||
| 3514 | supported = ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_filter_anisotropic")); never executed: return ba; | 0 | ||||||||||||||||||
| 3515 | break; never executed: break; | 0 | ||||||||||||||||||
| 3516 | - | |||||||||||||||||||
| 3517 | case NPOTTextures: never executed: case NPOTTextures: | 0 | ||||||||||||||||||
| 3518 | case NPOTTextureRepeat: never executed: case NPOTTextureRepeat: | 0 | ||||||||||||||||||
| 3519 | supported = f.version() >= qMakePair(3,0)
| 0 | ||||||||||||||||||
| 3520 | || ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_npot")) never executed: return ba;
| 0 | ||||||||||||||||||
| 3521 | || ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_non_power_of_two")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3522 | break; never executed: break; | 0 | ||||||||||||||||||
| 3523 | - | |||||||||||||||||||
| 3524 | case Texture1D: never executed: case Texture1D: | 0 | ||||||||||||||||||
| 3525 | break; never executed: break; | 0 | ||||||||||||||||||
| 3526 | - | |||||||||||||||||||
| 3527 | case TextureComparisonOperators: never executed: case TextureComparisonOperators: | 0 | ||||||||||||||||||
| 3528 | supported = f.version() >= qMakePair(3, 0)
| 0 | ||||||||||||||||||
| 3529 | || ctx->hasExtension(QByteArrayLiteral("GL_EXT_shadow_samplers")); never executed: return ba;
| 0 | ||||||||||||||||||
| 3530 | break; never executed: break; | 0 | ||||||||||||||||||
| 3531 | - | |||||||||||||||||||
| 3532 | case TextureMipMapLevel: never executed: case TextureMipMapLevel: | 0 | ||||||||||||||||||
| 3533 | supported = f.version() >= qMakePair(3, 0); | - | ||||||||||||||||||
| 3534 | break; never executed: break; | 0 | ||||||||||||||||||
| 3535 | - | |||||||||||||||||||
| 3536 | case MaxFeatureFlag: never executed: case MaxFeatureFlag: | 0 | ||||||||||||||||||
| 3537 | break; never executed: break; | 0 | ||||||||||||||||||
| 3538 | } | - | ||||||||||||||||||
| 3539 | } never executed: end of block | 0 | ||||||||||||||||||
| 3540 | - | |||||||||||||||||||
| 3541 | return supported; never executed: return supported; | 0 | ||||||||||||||||||
| 3542 | } | - | ||||||||||||||||||
| 3543 | - | |||||||||||||||||||
| 3544 | /*! | - | ||||||||||||||||||
| 3545 | Sets the base mipmap level used for all texture lookups with this texture to \a baseLevel. | - | ||||||||||||||||||
| 3546 | - | |||||||||||||||||||
| 3547 | \note This function has no effect on Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 3548 | \sa mipBaseLevel(), setMipMaxLevel(), setMipLevelRange() | - | ||||||||||||||||||
| 3549 | */ | - | ||||||||||||||||||
| 3550 | void QOpenGLTexture::setMipBaseLevel(int baseLevel) | - | ||||||||||||||||||
| 3551 | { | - | ||||||||||||||||||
| 3552 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3553 | d->create(); | - | ||||||||||||||||||
| 3554 | if (!d->features.testFlag(TextureMipMapLevel)) {
| 0 | ||||||||||||||||||
| 3555 | qWarning("QOpenGLTexture::setMipBaseLevel: requires OpenGL >= 1.2 or OpenGL ES >= 3.0"); | - | ||||||||||||||||||
| 3556 | return; never executed: return; | 0 | ||||||||||||||||||
| 3557 | } | - | ||||||||||||||||||
| 3558 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3559 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3560 | Q_ASSERT(baseLevel <= d->maxLevel); | - | ||||||||||||||||||
| 3561 | d->baseLevel = baseLevel; | - | ||||||||||||||||||
| 3562 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_BASE_LEVEL, baseLevel); | - | ||||||||||||||||||
| 3563 | } never executed: end of block | 0 | ||||||||||||||||||
| 3564 | - | |||||||||||||||||||
| 3565 | /*! | - | ||||||||||||||||||
| 3566 | Returns the mipmap base level used for all texture lookups with this texture. | - | ||||||||||||||||||
| 3567 | The default is 0. | - | ||||||||||||||||||
| 3568 | - | |||||||||||||||||||
| 3569 | \sa setMipBaseLevel(), mipMaxLevel(), mipLevelRange() | - | ||||||||||||||||||
| 3570 | */ | - | ||||||||||||||||||
| 3571 | int QOpenGLTexture::mipBaseLevel() const | - | ||||||||||||||||||
| 3572 | { | - | ||||||||||||||||||
| 3573 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3574 | return d->baseLevel; never executed: return d->baseLevel; | 0 | ||||||||||||||||||
| 3575 | } | - | ||||||||||||||||||
| 3576 | - | |||||||||||||||||||
| 3577 | /*! | - | ||||||||||||||||||
| 3578 | Sets the maximum mipmap level used for all texture lookups with this texture to \a maxLevel. | - | ||||||||||||||||||
| 3579 | - | |||||||||||||||||||
| 3580 | \note This function has no effect on Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 3581 | \sa mipMaxLevel(), setMipBaseLevel(), setMipLevelRange() | - | ||||||||||||||||||
| 3582 | */ | - | ||||||||||||||||||
| 3583 | void QOpenGLTexture::setMipMaxLevel(int maxLevel) | - | ||||||||||||||||||
| 3584 | { | - | ||||||||||||||||||
| 3585 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3586 | d->create(); | - | ||||||||||||||||||
| 3587 | if (!d->features.testFlag(TextureMipMapLevel)) {
| 0 | ||||||||||||||||||
| 3588 | qWarning("QOpenGLTexture::setMipMaxLevel: requires OpenGL >= 1.2 or OpenGL ES >= 3.0"); | - | ||||||||||||||||||
| 3589 | return; never executed: return; | 0 | ||||||||||||||||||
| 3590 | } | - | ||||||||||||||||||
| 3591 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3592 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3593 | Q_ASSERT(d->baseLevel <= maxLevel); | - | ||||||||||||||||||
| 3594 | d->maxLevel = maxLevel; | - | ||||||||||||||||||
| 3595 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAX_LEVEL, maxLevel); | - | ||||||||||||||||||
| 3596 | } never executed: end of block | 0 | ||||||||||||||||||
| 3597 | - | |||||||||||||||||||
| 3598 | /*! | - | ||||||||||||||||||
| 3599 | Returns the mipmap maximum level used for all texture lookups with this texture. | - | ||||||||||||||||||
| 3600 | - | |||||||||||||||||||
| 3601 | \sa setMipMaxLevel(), mipBaseLevel(), mipLevelRange() | - | ||||||||||||||||||
| 3602 | */ | - | ||||||||||||||||||
| 3603 | int QOpenGLTexture::mipMaxLevel() const | - | ||||||||||||||||||
| 3604 | { | - | ||||||||||||||||||
| 3605 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3606 | return d->maxLevel; never executed: return d->maxLevel; | 0 | ||||||||||||||||||
| 3607 | } | - | ||||||||||||||||||
| 3608 | - | |||||||||||||||||||
| 3609 | /*! | - | ||||||||||||||||||
| 3610 | Sets the range of mipmap levels that can be used for texture lookups with this texture | - | ||||||||||||||||||
| 3611 | to range from \a baseLevel to \a maxLevel. | - | ||||||||||||||||||
| 3612 | - | |||||||||||||||||||
| 3613 | \note This function has no effect on Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 3614 | \sa setMipBaseLevel(), setMipMaxLevel(), mipLevelRange() | - | ||||||||||||||||||
| 3615 | */ | - | ||||||||||||||||||
| 3616 | void QOpenGLTexture::setMipLevelRange(int baseLevel, int maxLevel) | - | ||||||||||||||||||
| 3617 | { | - | ||||||||||||||||||
| 3618 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3619 | d->create(); | - | ||||||||||||||||||
| 3620 | if (!d->features.testFlag(TextureMipMapLevel)) {
| 0 | ||||||||||||||||||
| 3621 | qWarning("QOpenGLTexture::setMipLevelRange: requires OpenGL >= 1.2 or OpenGL ES >= 3.0"); | - | ||||||||||||||||||
| 3622 | return; never executed: return; | 0 | ||||||||||||||||||
| 3623 | } | - | ||||||||||||||||||
| 3624 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3625 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3626 | Q_ASSERT(baseLevel <= maxLevel); | - | ||||||||||||||||||
| 3627 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_BASE_LEVEL, baseLevel); | - | ||||||||||||||||||
| 3628 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAX_LEVEL, maxLevel); | - | ||||||||||||||||||
| 3629 | } never executed: end of block | 0 | ||||||||||||||||||
| 3630 | - | |||||||||||||||||||
| 3631 | /*! | - | ||||||||||||||||||
| 3632 | Returns the range of mipmap levels that can be used for texture lookups with this texture. | - | ||||||||||||||||||
| 3633 | - | |||||||||||||||||||
| 3634 | \sa mipBaseLevel(), mipMaxLevel() | - | ||||||||||||||||||
| 3635 | */ | - | ||||||||||||||||||
| 3636 | QPair<int, int> QOpenGLTexture::mipLevelRange() const | - | ||||||||||||||||||
| 3637 | { | - | ||||||||||||||||||
| 3638 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3639 | return qMakePair(d->baseLevel, d->maxLevel); never executed: return qMakePair(d->baseLevel, d->maxLevel); | 0 | ||||||||||||||||||
| 3640 | } | - | ||||||||||||||||||
| 3641 | - | |||||||||||||||||||
| 3642 | /*! | - | ||||||||||||||||||
| 3643 | If \a enabled is \c true, enables automatic mipmap generation for this texture object | - | ||||||||||||||||||
| 3644 | to occur whenever the level 0 mipmap data is set via setData(). | - | ||||||||||||||||||
| 3645 | - | |||||||||||||||||||
| 3646 | The automatic mipmap generation is enabled by default. | - | ||||||||||||||||||
| 3647 | - | |||||||||||||||||||
| 3648 | \note Mipmap generation is not supported for compressed textures with OpenGL ES 2.0. | - | ||||||||||||||||||
| 3649 | - | |||||||||||||||||||
| 3650 | \sa isAutoMipMapGenerationEnabled(), generateMipMaps() | - | ||||||||||||||||||
| 3651 | */ | - | ||||||||||||||||||
| 3652 | void QOpenGLTexture::setAutoMipMapGenerationEnabled(bool enabled) | - | ||||||||||||||||||
| 3653 | { | - | ||||||||||||||||||
| 3654 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3655 | d->autoGenerateMipMaps = enabled; | - | ||||||||||||||||||
| 3656 | } never executed: end of block | 0 | ||||||||||||||||||
| 3657 | - | |||||||||||||||||||
| 3658 | /*! | - | ||||||||||||||||||
| 3659 | Returns whether auto mipmap generation is enabled for this texture object. | - | ||||||||||||||||||
| 3660 | - | |||||||||||||||||||
| 3661 | \sa setAutoMipMapGenerationEnabled(), generateMipMaps() | - | ||||||||||||||||||
| 3662 | */ | - | ||||||||||||||||||
| 3663 | bool QOpenGLTexture::isAutoMipMapGenerationEnabled() const | - | ||||||||||||||||||
| 3664 | { | - | ||||||||||||||||||
| 3665 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3666 | return d->autoGenerateMipMaps; never executed: return d->autoGenerateMipMaps; | 0 | ||||||||||||||||||
| 3667 | } | - | ||||||||||||||||||
| 3668 | - | |||||||||||||||||||
| 3669 | /*! | - | ||||||||||||||||||
| 3670 | Generates mipmaps for this texture object from mipmap level 0. If you are | - | ||||||||||||||||||
| 3671 | using a texture target and filtering option that requires mipmaps and you | - | ||||||||||||||||||
| 3672 | have disabled automatic mipmap generation then you need to call this function | - | ||||||||||||||||||
| 3673 | or the overload to create the mipmap chain. | - | ||||||||||||||||||
| 3674 | - | |||||||||||||||||||
| 3675 | \note Mipmap generation is not supported for compressed textures with OpenGL | - | ||||||||||||||||||
| 3676 | ES 2.0. | - | ||||||||||||||||||
| 3677 | - | |||||||||||||||||||
| 3678 | \sa setAutoMipMapGenerationEnabled(), setMipLevels(), mipLevels() | - | ||||||||||||||||||
| 3679 | */ | - | ||||||||||||||||||
| 3680 | void QOpenGLTexture::generateMipMaps() | - | ||||||||||||||||||
| 3681 | { | - | ||||||||||||||||||
| 3682 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3683 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3684 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3685 | if (isCompressedFormat(d->format)) {
| 0 | ||||||||||||||||||
| 3686 | if (QOpenGLContext *ctx = QOpenGLContext::currentContext())
| 0 | ||||||||||||||||||
| 3687 | if (ctx->isOpenGLES() && ctx->format().majorVersion() < 3)
| 0 | ||||||||||||||||||
| 3688 | return; never executed: return; | 0 | ||||||||||||||||||
| 3689 | } never executed: end of block | 0 | ||||||||||||||||||
| 3690 | d->texFuncs->glGenerateTextureMipmap(d->textureId, d->target, d->bindingTarget); | - | ||||||||||||||||||
| 3691 | } never executed: end of block | 0 | ||||||||||||||||||
| 3692 | - | |||||||||||||||||||
| 3693 | /*! | - | ||||||||||||||||||
| 3694 | Generates mipmaps for this texture object from mipmap level \a baseLevel. If you are | - | ||||||||||||||||||
| 3695 | using a texture target and filtering option that requires mipmaps and you | - | ||||||||||||||||||
| 3696 | have disabled automatic mipmap generation then you need to call this function | - | ||||||||||||||||||
| 3697 | or the overload to create the mipmap chain. | - | ||||||||||||||||||
| 3698 | - | |||||||||||||||||||
| 3699 | The generation of mipmaps to above \a baseLevel is achieved by setting the mipmap | - | ||||||||||||||||||
| 3700 | base level to \a baseLevel and then generating the mipmap chain. If \a resetBaseLevel | - | ||||||||||||||||||
| 3701 | is \c true, then the baseLevel of the texture will be reset to its previous value. | - | ||||||||||||||||||
| 3702 | - | |||||||||||||||||||
| 3703 | \sa setAutoMipMapGenerationEnabled(), setMipLevels(), mipLevels() | - | ||||||||||||||||||
| 3704 | */ | - | ||||||||||||||||||
| 3705 | void QOpenGLTexture::generateMipMaps(int baseLevel, bool resetBaseLevel) | - | ||||||||||||||||||
| 3706 | { | - | ||||||||||||||||||
| 3707 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3708 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3709 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3710 | if (isCompressedFormat(d->format)) {
| 0 | ||||||||||||||||||
| 3711 | if (QOpenGLContext *ctx = QOpenGLContext::currentContext())
| 0 | ||||||||||||||||||
| 3712 | if (ctx->isOpenGLES() && ctx->format().majorVersion() < 3)
| 0 | ||||||||||||||||||
| 3713 | return; never executed: return; | 0 | ||||||||||||||||||
| 3714 | } never executed: end of block | 0 | ||||||||||||||||||
| 3715 | int oldBaseLevel; | - | ||||||||||||||||||
| 3716 | if (resetBaseLevel)
| 0 | ||||||||||||||||||
| 3717 | oldBaseLevel = mipBaseLevel(); never executed: oldBaseLevel = mipBaseLevel(); | 0 | ||||||||||||||||||
| 3718 | setMipBaseLevel(baseLevel); | - | ||||||||||||||||||
| 3719 | d->texFuncs->glGenerateTextureMipmap(d->textureId, d->target, d->bindingTarget); | - | ||||||||||||||||||
| 3720 | if (resetBaseLevel)
| 0 | ||||||||||||||||||
| 3721 | setMipBaseLevel(oldBaseLevel); never executed: setMipBaseLevel(oldBaseLevel); | 0 | ||||||||||||||||||
| 3722 | } never executed: end of block | 0 | ||||||||||||||||||
| 3723 | - | |||||||||||||||||||
| 3724 | /*! | - | ||||||||||||||||||
| 3725 | GLSL shaders are able to reorder the components of the vec4 returned by texture | - | ||||||||||||||||||
| 3726 | functions. It is also desirable to be able to control this reordering from CPU | - | ||||||||||||||||||
| 3727 | side code. This is made possible by swizzle masks since OpenGL 3.3. | - | ||||||||||||||||||
| 3728 | - | |||||||||||||||||||
| 3729 | Each component of the texture can be mapped to one of the SwizzleValue options. | - | ||||||||||||||||||
| 3730 | - | |||||||||||||||||||
| 3731 | This function maps \a component to the output \a value. | - | ||||||||||||||||||
| 3732 | - | |||||||||||||||||||
| 3733 | \note This function has no effect on Mac and Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 3734 | \sa swizzleMask() | - | ||||||||||||||||||
| 3735 | */ | - | ||||||||||||||||||
| 3736 | void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue value) | - | ||||||||||||||||||
| 3737 | { | - | ||||||||||||||||||
| 3738 | #if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 3739 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 3740 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3741 | d->create(); | - | ||||||||||||||||||
| 3742 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3743 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3744 | if (!d->features.testFlag(Swizzle)) {
| 0 | ||||||||||||||||||
| 3745 | qWarning("QOpenGLTexture::setSwizzleMask() requires OpenGL >= 3.3"); | - | ||||||||||||||||||
| 3746 | return; never executed: return; | 0 | ||||||||||||||||||
| 3747 | } | - | ||||||||||||||||||
| 3748 | d->swizzleMask[component - SwizzleRed] = value; | - | ||||||||||||||||||
| 3749 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, component, value); | - | ||||||||||||||||||
| 3750 | return; never executed: return; | 0 | ||||||||||||||||||
| 3751 | } | - | ||||||||||||||||||
| 3752 | #else | - | ||||||||||||||||||
| 3753 | Q_UNUSED(component); | - | ||||||||||||||||||
| 3754 | Q_UNUSED(value); | - | ||||||||||||||||||
| 3755 | #endif | - | ||||||||||||||||||
| 3756 | qWarning("QOpenGLTexture: Texture swizzling is not supported"); | - | ||||||||||||||||||
| 3757 | } never executed: end of block | 0 | ||||||||||||||||||
| 3758 | - | |||||||||||||||||||
| 3759 | /*! | - | ||||||||||||||||||
| 3760 | Parameters \a {r}, \a {g}, \a {b}, and \a {a} are values used for setting | - | ||||||||||||||||||
| 3761 | the colors red, green, blue, and the alpha value. | - | ||||||||||||||||||
| 3762 | \overload | - | ||||||||||||||||||
| 3763 | */ | - | ||||||||||||||||||
| 3764 | void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g, | - | ||||||||||||||||||
| 3765 | SwizzleValue b, SwizzleValue a) | - | ||||||||||||||||||
| 3766 | { | - | ||||||||||||||||||
| 3767 | #if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 3768 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 3769 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3770 | d->create(); | - | ||||||||||||||||||
| 3771 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3772 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3773 | if (!d->features.testFlag(Swizzle)) {
| 0 | ||||||||||||||||||
| 3774 | qWarning("QOpenGLTexture::setSwizzleMask() requires OpenGL >= 3.3"); | - | ||||||||||||||||||
| 3775 | return; never executed: return; | 0 | ||||||||||||||||||
| 3776 | } | - | ||||||||||||||||||
| 3777 | GLint swizzleMask[] = {GLint(r), GLint(g), GLint(b), GLint(a)}; | - | ||||||||||||||||||
| 3778 | d->swizzleMask[0] = r; | - | ||||||||||||||||||
| 3779 | d->swizzleMask[1] = g; | - | ||||||||||||||||||
| 3780 | d->swizzleMask[2] = b; | - | ||||||||||||||||||
| 3781 | d->swizzleMask[3] = a; | - | ||||||||||||||||||
| 3782 | d->texFuncs->glTextureParameteriv(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask); | - | ||||||||||||||||||
| 3783 | return; never executed: return; | 0 | ||||||||||||||||||
| 3784 | } | - | ||||||||||||||||||
| 3785 | #else | - | ||||||||||||||||||
| 3786 | Q_UNUSED(r); | - | ||||||||||||||||||
| 3787 | Q_UNUSED(g); | - | ||||||||||||||||||
| 3788 | Q_UNUSED(b); | - | ||||||||||||||||||
| 3789 | Q_UNUSED(a); | - | ||||||||||||||||||
| 3790 | #endif | - | ||||||||||||||||||
| 3791 | qWarning("QOpenGLTexture: Texture swizzling is not supported"); | - | ||||||||||||||||||
| 3792 | } never executed: end of block | 0 | ||||||||||||||||||
| 3793 | - | |||||||||||||||||||
| 3794 | /*! | - | ||||||||||||||||||
| 3795 | Returns the swizzle mask for texture \a component. | - | ||||||||||||||||||
| 3796 | */ | - | ||||||||||||||||||
| 3797 | QOpenGLTexture::SwizzleValue QOpenGLTexture::swizzleMask(SwizzleComponent component) const | - | ||||||||||||||||||
| 3798 | { | - | ||||||||||||||||||
| 3799 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3800 | return d->swizzleMask[component - SwizzleRed]; never executed: return d->swizzleMask[component - SwizzleRed]; | 0 | ||||||||||||||||||
| 3801 | } | - | ||||||||||||||||||
| 3802 | - | |||||||||||||||||||
| 3803 | /*! | - | ||||||||||||||||||
| 3804 | \enum QOpenGLTexture::DepthStencilMode | - | ||||||||||||||||||
| 3805 | \since 5.4 | - | ||||||||||||||||||
| 3806 | This enum specifies which component of a depth/stencil texture is | - | ||||||||||||||||||
| 3807 | accessed when the texture is sampled. | - | ||||||||||||||||||
| 3808 | - | |||||||||||||||||||
| 3809 | \value DepthMode Equivalent to GL_DEPTH_COMPONENT. | - | ||||||||||||||||||
| 3810 | \value StencilMode Equivalent to GL_STENCIL_INDEX. | - | ||||||||||||||||||
| 3811 | */ | - | ||||||||||||||||||
| 3812 | - | |||||||||||||||||||
| 3813 | /*! | - | ||||||||||||||||||
| 3814 | If using a texture that has a combined depth/stencil format this function sets | - | ||||||||||||||||||
| 3815 | which component of the texture is accessed to \a mode. | - | ||||||||||||||||||
| 3816 | - | |||||||||||||||||||
| 3817 | When the parameter is set to DepthMode, then accessing it from the | - | ||||||||||||||||||
| 3818 | shader will access the depth component as a single float, as normal. But when | - | ||||||||||||||||||
| 3819 | the parameter is set to StencilMode, the shader will access the stencil component. | - | ||||||||||||||||||
| 3820 | - | |||||||||||||||||||
| 3821 | \note This function has no effect on Mac and Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 3822 | \since 5.4 | - | ||||||||||||||||||
| 3823 | \sa depthStencilMode() | - | ||||||||||||||||||
| 3824 | */ | - | ||||||||||||||||||
| 3825 | void QOpenGLTexture::setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode) | - | ||||||||||||||||||
| 3826 | { | - | ||||||||||||||||||
| 3827 | #if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 3828 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 3829 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3830 | d->create(); | - | ||||||||||||||||||
| 3831 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3832 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3833 | if (!d->features.testFlag(StencilTexturing)) {
| 0 | ||||||||||||||||||
| 3834 | qWarning("QOpenGLTexture::setDepthStencilMode() requires OpenGL >= 4.3 or GL_ARB_stencil_texturing"); | - | ||||||||||||||||||
| 3835 | return; never executed: return; | 0 | ||||||||||||||||||
| 3836 | } | - | ||||||||||||||||||
| 3837 | d->depthStencilMode = mode; | - | ||||||||||||||||||
| 3838 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_DEPTH_STENCIL_TEXTURE_MODE, mode); | - | ||||||||||||||||||
| 3839 | return; never executed: return; | 0 | ||||||||||||||||||
| 3840 | } | - | ||||||||||||||||||
| 3841 | #else | - | ||||||||||||||||||
| 3842 | Q_UNUSED(mode); | - | ||||||||||||||||||
| 3843 | #endif | - | ||||||||||||||||||
| 3844 | qWarning("QOpenGLTexture: DepthStencil Mode is not supported"); | - | ||||||||||||||||||
| 3845 | } never executed: end of block | 0 | ||||||||||||||||||
| 3846 | - | |||||||||||||||||||
| 3847 | /*! | - | ||||||||||||||||||
| 3848 | Returns the depth stencil mode for textures using a combined depth/stencil format. | - | ||||||||||||||||||
| 3849 | - | |||||||||||||||||||
| 3850 | \since 5.4 | - | ||||||||||||||||||
| 3851 | \sa setDepthStencilMode() | - | ||||||||||||||||||
| 3852 | */ | - | ||||||||||||||||||
| 3853 | QOpenGLTexture::DepthStencilMode QOpenGLTexture::depthStencilMode() const | - | ||||||||||||||||||
| 3854 | { | - | ||||||||||||||||||
| 3855 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3856 | return d->depthStencilMode; never executed: return d->depthStencilMode; | 0 | ||||||||||||||||||
| 3857 | } | - | ||||||||||||||||||
| 3858 | - | |||||||||||||||||||
| 3859 | /*! | - | ||||||||||||||||||
| 3860 | \enum QOpenGLTexture::ComparisonFunction | - | ||||||||||||||||||
| 3861 | \since 5.5 | - | ||||||||||||||||||
| 3862 | This enum specifies which comparison operator is used when texture comparison | - | ||||||||||||||||||
| 3863 | is enabled on this texture. | - | ||||||||||||||||||
| 3864 | - | |||||||||||||||||||
| 3865 | \value CompareLessEqual Equivalent to GL_LEQUAL. | - | ||||||||||||||||||
| 3866 | \value CompareGreaterEqual Equivalent to GL_GEQUAL. | - | ||||||||||||||||||
| 3867 | \value CompareLess Equivalent to GL_LESS. | - | ||||||||||||||||||
| 3868 | \value CompareGreater Equivalent to GL_GREATER. | - | ||||||||||||||||||
| 3869 | \value CompareEqual Equivalent to GL_EQUAL. | - | ||||||||||||||||||
| 3870 | \value CommpareNotEqual Equivalent to GL_NOTEQUAL. | - | ||||||||||||||||||
| 3871 | \value CompareAlways Equivalent to GL_ALWAYS. | - | ||||||||||||||||||
| 3872 | \value CompareNever Equivalent to GL_NEVER. | - | ||||||||||||||||||
| 3873 | - | |||||||||||||||||||
| 3874 | */ | - | ||||||||||||||||||
| 3875 | - | |||||||||||||||||||
| 3876 | /* | - | ||||||||||||||||||
| 3877 | \since 5.5 | - | ||||||||||||||||||
| 3878 | - | |||||||||||||||||||
| 3879 | Sets the texture comparison function on this texture to \a function. The texture | - | ||||||||||||||||||
| 3880 | comparison function is used by shadow samplers when sampling a depth texture. | - | ||||||||||||||||||
| 3881 | - | |||||||||||||||||||
| 3882 | \sa comparisonFunction() | - | ||||||||||||||||||
| 3883 | */ | - | ||||||||||||||||||
| 3884 | void QOpenGLTexture::setComparisonFunction(QOpenGLTexture::ComparisonFunction function) | - | ||||||||||||||||||
| 3885 | { | - | ||||||||||||||||||
| 3886 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3887 | d->create(); | - | ||||||||||||||||||
| 3888 | if (!d->features.testFlag(TextureComparisonOperators)) {
| 0 | ||||||||||||||||||
| 3889 | qWarning("QOpenGLTexture::setComparisonFunction: requires OpenGL >= 1.5 or OpenGL ES >= 3.0"); | - | ||||||||||||||||||
| 3890 | return; never executed: return; | 0 | ||||||||||||||||||
| 3891 | } | - | ||||||||||||||||||
| 3892 | d->comparisonFunction = function; | - | ||||||||||||||||||
| 3893 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_COMPARE_FUNC, function); | - | ||||||||||||||||||
| 3894 | } never executed: end of block | 0 | ||||||||||||||||||
| 3895 | - | |||||||||||||||||||
| 3896 | /*! | - | ||||||||||||||||||
| 3897 | \since 5.5 | - | ||||||||||||||||||
| 3898 | - | |||||||||||||||||||
| 3899 | Returns the texture comparison operator set on this texture. By default, a | - | ||||||||||||||||||
| 3900 | texture has a CompareLessEqual comparison function. | - | ||||||||||||||||||
| 3901 | - | |||||||||||||||||||
| 3902 | \sa setComparisonFunction() | - | ||||||||||||||||||
| 3903 | */ | - | ||||||||||||||||||
| 3904 | QOpenGLTexture::ComparisonFunction QOpenGLTexture::comparisonFunction() const | - | ||||||||||||||||||
| 3905 | { | - | ||||||||||||||||||
| 3906 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3907 | return d->comparisonFunction; never executed: return d->comparisonFunction; | 0 | ||||||||||||||||||
| 3908 | } | - | ||||||||||||||||||
| 3909 | - | |||||||||||||||||||
| 3910 | /*! | - | ||||||||||||||||||
| 3911 | \enum QOpenGLTexture::ComparisonMode | - | ||||||||||||||||||
| 3912 | \since 5.5 | - | ||||||||||||||||||
| 3913 | This enum specifies which comparison mode is used when sampling this texture. | - | ||||||||||||||||||
| 3914 | - | |||||||||||||||||||
| 3915 | \value CompareRefToTexture Equivalent to GL_COMPARE_REF_TO_TEXTURE. | - | ||||||||||||||||||
| 3916 | \value CompareNone Equivalent to GL_NONE. | - | ||||||||||||||||||
| 3917 | */ | - | ||||||||||||||||||
| 3918 | - | |||||||||||||||||||
| 3919 | /*! | - | ||||||||||||||||||
| 3920 | \since 5.5 | - | ||||||||||||||||||
| 3921 | - | |||||||||||||||||||
| 3922 | Sets the texture comparison mode on this texture to \a mode. The texture | - | ||||||||||||||||||
| 3923 | comparison mode is used by shadow samplers when sampling a depth texture. | - | ||||||||||||||||||
| 3924 | - | |||||||||||||||||||
| 3925 | \sa comparisonMode() | - | ||||||||||||||||||
| 3926 | */ | - | ||||||||||||||||||
| 3927 | void QOpenGLTexture::setComparisonMode(QOpenGLTexture::ComparisonMode mode) | - | ||||||||||||||||||
| 3928 | { | - | ||||||||||||||||||
| 3929 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3930 | d->create(); | - | ||||||||||||||||||
| 3931 | if (!d->features.testFlag(TextureComparisonOperators)) {
| 0 | ||||||||||||||||||
| 3932 | qWarning("QOpenGLTexture::setComparisonMode: requires OpenGL >= 1.5 or OpenGL ES >= 3.0"); | - | ||||||||||||||||||
| 3933 | return; never executed: return; | 0 | ||||||||||||||||||
| 3934 | } | - | ||||||||||||||||||
| 3935 | d->comparisonMode = mode; | - | ||||||||||||||||||
| 3936 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_COMPARE_MODE, mode); | - | ||||||||||||||||||
| 3937 | } never executed: end of block | 0 | ||||||||||||||||||
| 3938 | - | |||||||||||||||||||
| 3939 | /*! | - | ||||||||||||||||||
| 3940 | \since 5.5 | - | ||||||||||||||||||
| 3941 | - | |||||||||||||||||||
| 3942 | Returns the texture comparison mode set on this texture. By default, a | - | ||||||||||||||||||
| 3943 | texture has a CompareNone comparison mode (i.e. comparisons are disabled). | - | ||||||||||||||||||
| 3944 | - | |||||||||||||||||||
| 3945 | \sa setComparisonMode() | - | ||||||||||||||||||
| 3946 | */ | - | ||||||||||||||||||
| 3947 | QOpenGLTexture::ComparisonMode QOpenGLTexture::comparisonMode() const | - | ||||||||||||||||||
| 3948 | { | - | ||||||||||||||||||
| 3949 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3950 | return d->comparisonMode; never executed: return d->comparisonMode; | 0 | ||||||||||||||||||
| 3951 | } | - | ||||||||||||||||||
| 3952 | - | |||||||||||||||||||
| 3953 | /*! | - | ||||||||||||||||||
| 3954 | Sets the filter used for minification to \a filter. | - | ||||||||||||||||||
| 3955 | - | |||||||||||||||||||
| 3956 | \sa minificationFilter(), setMagnificationFilter(), setMinMagFilters() | - | ||||||||||||||||||
| 3957 | */ | - | ||||||||||||||||||
| 3958 | void QOpenGLTexture::setMinificationFilter(QOpenGLTexture::Filter filter) | - | ||||||||||||||||||
| 3959 | { | - | ||||||||||||||||||
| 3960 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3961 | d->create(); | - | ||||||||||||||||||
| 3962 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3963 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3964 | d->minFilter = filter; | - | ||||||||||||||||||
| 3965 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MIN_FILTER, filter); | - | ||||||||||||||||||
| 3966 | } never executed: end of block | 0 | ||||||||||||||||||
| 3967 | - | |||||||||||||||||||
| 3968 | /*! | - | ||||||||||||||||||
| 3969 | Returns the minification filter. | - | ||||||||||||||||||
| 3970 | - | |||||||||||||||||||
| 3971 | \sa setMinificationFilter() | - | ||||||||||||||||||
| 3972 | */ | - | ||||||||||||||||||
| 3973 | QOpenGLTexture::Filter QOpenGLTexture::minificationFilter() const | - | ||||||||||||||||||
| 3974 | { | - | ||||||||||||||||||
| 3975 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 3976 | return d->minFilter; never executed: return d->minFilter; | 0 | ||||||||||||||||||
| 3977 | } | - | ||||||||||||||||||
| 3978 | - | |||||||||||||||||||
| 3979 | /*! | - | ||||||||||||||||||
| 3980 | Sets the magnification filter to \a filter. | - | ||||||||||||||||||
| 3981 | - | |||||||||||||||||||
| 3982 | \sa magnificationFilter(), setMinificationFilter(), setMinMagFilters() | - | ||||||||||||||||||
| 3983 | */ | - | ||||||||||||||||||
| 3984 | void QOpenGLTexture::setMagnificationFilter(QOpenGLTexture::Filter filter) | - | ||||||||||||||||||
| 3985 | { | - | ||||||||||||||||||
| 3986 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 3987 | d->create(); | - | ||||||||||||||||||
| 3988 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 3989 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 3990 | d->magFilter = filter; | - | ||||||||||||||||||
| 3991 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAG_FILTER, filter); | - | ||||||||||||||||||
| 3992 | } never executed: end of block | 0 | ||||||||||||||||||
| 3993 | - | |||||||||||||||||||
| 3994 | /*! | - | ||||||||||||||||||
| 3995 | Returns the magnification filter. | - | ||||||||||||||||||
| 3996 | - | |||||||||||||||||||
| 3997 | \sa setMagnificationFilter() | - | ||||||||||||||||||
| 3998 | */ | - | ||||||||||||||||||
| 3999 | QOpenGLTexture::Filter QOpenGLTexture::magnificationFilter() const | - | ||||||||||||||||||
| 4000 | { | - | ||||||||||||||||||
| 4001 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4002 | return d->magFilter; never executed: return d->magFilter; | 0 | ||||||||||||||||||
| 4003 | } | - | ||||||||||||||||||
| 4004 | - | |||||||||||||||||||
| 4005 | /*! | - | ||||||||||||||||||
| 4006 | Sets the minification filter to \a minificationFilter and the magnification filter | - | ||||||||||||||||||
| 4007 | to \a magnificationFilter. | - | ||||||||||||||||||
| 4008 | - | |||||||||||||||||||
| 4009 | \sa minMagFilters(), setMinificationFilter(), setMagnificationFilter() | - | ||||||||||||||||||
| 4010 | */ | - | ||||||||||||||||||
| 4011 | void QOpenGLTexture::setMinMagFilters(QOpenGLTexture::Filter minificationFilter, | - | ||||||||||||||||||
| 4012 | QOpenGLTexture::Filter magnificationFilter) | - | ||||||||||||||||||
| 4013 | { | - | ||||||||||||||||||
| 4014 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4015 | d->create(); | - | ||||||||||||||||||
| 4016 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4017 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4018 | d->minFilter = minificationFilter; | - | ||||||||||||||||||
| 4019 | d->magFilter = magnificationFilter; | - | ||||||||||||||||||
| 4020 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MIN_FILTER, minificationFilter); | - | ||||||||||||||||||
| 4021 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAG_FILTER, magnificationFilter); | - | ||||||||||||||||||
| 4022 | } never executed: end of block | 0 | ||||||||||||||||||
| 4023 | - | |||||||||||||||||||
| 4024 | /*! | - | ||||||||||||||||||
| 4025 | Returns the current minification and magnification filters. | - | ||||||||||||||||||
| 4026 | - | |||||||||||||||||||
| 4027 | \sa setMinMagFilters() | - | ||||||||||||||||||
| 4028 | */ | - | ||||||||||||||||||
| 4029 | QPair<QOpenGLTexture::Filter, QOpenGLTexture::Filter> QOpenGLTexture::minMagFilters() const | - | ||||||||||||||||||
| 4030 | { | - | ||||||||||||||||||
| 4031 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4032 | return QPair<QOpenGLTexture::Filter, QOpenGLTexture::Filter>(d->minFilter, d->magFilter); never executed: return QPair<QOpenGLTexture::Filter, QOpenGLTexture::Filter>(d->minFilter, d->magFilter); | 0 | ||||||||||||||||||
| 4033 | } | - | ||||||||||||||||||
| 4034 | - | |||||||||||||||||||
| 4035 | /*! | - | ||||||||||||||||||
| 4036 | If your OpenGL implementation supports the GL_EXT_texture_filter_anisotropic extension | - | ||||||||||||||||||
| 4037 | this function sets the maximum anisotropy level to \a anisotropy. | - | ||||||||||||||||||
| 4038 | - | |||||||||||||||||||
| 4039 | \sa maximumAnisotropy() | - | ||||||||||||||||||
| 4040 | */ | - | ||||||||||||||||||
| 4041 | void QOpenGLTexture::setMaximumAnisotropy(float anisotropy) | - | ||||||||||||||||||
| 4042 | { | - | ||||||||||||||||||
| 4043 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4044 | d->create(); | - | ||||||||||||||||||
| 4045 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4046 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4047 | if (!d->features.testFlag(AnisotropicFiltering)) {
| 0 | ||||||||||||||||||
| 4048 | qWarning("QOpenGLTexture::setMaximumAnisotropy() requires GL_EXT_texture_filter_anisotropic"); | - | ||||||||||||||||||
| 4049 | return; never executed: return; | 0 | ||||||||||||||||||
| 4050 | } | - | ||||||||||||||||||
| 4051 | d->maxAnisotropy = anisotropy; | - | ||||||||||||||||||
| 4052 | d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy); | - | ||||||||||||||||||
| 4053 | } never executed: end of block | 0 | ||||||||||||||||||
| 4054 | - | |||||||||||||||||||
| 4055 | /*! | - | ||||||||||||||||||
| 4056 | Returns the maximum level of anisotropy to be accounted for when performing texture lookups. | - | ||||||||||||||||||
| 4057 | This requires the GL_EXT_texture_filter_anisotropic extension. | - | ||||||||||||||||||
| 4058 | - | |||||||||||||||||||
| 4059 | \sa setMaximumAnisotropy() | - | ||||||||||||||||||
| 4060 | */ | - | ||||||||||||||||||
| 4061 | float QOpenGLTexture::maximumAnisotropy() const | - | ||||||||||||||||||
| 4062 | { | - | ||||||||||||||||||
| 4063 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4064 | return d->maxAnisotropy; never executed: return d->maxAnisotropy; | 0 | ||||||||||||||||||
| 4065 | } | - | ||||||||||||||||||
| 4066 | - | |||||||||||||||||||
| 4067 | /*! | - | ||||||||||||||||||
| 4068 | Sets the wrap (or repeat mode) for all texture dimentions to \a mode. | - | ||||||||||||||||||
| 4069 | - | |||||||||||||||||||
| 4070 | \sa wrapMode() | - | ||||||||||||||||||
| 4071 | */ | - | ||||||||||||||||||
| 4072 | void QOpenGLTexture::setWrapMode(QOpenGLTexture::WrapMode mode) | - | ||||||||||||||||||
| 4073 | { | - | ||||||||||||||||||
| 4074 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4075 | d->create(); | - | ||||||||||||||||||
| 4076 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4077 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4078 | d->setWrapMode(mode); | - | ||||||||||||||||||
| 4079 | } never executed: end of block | 0 | ||||||||||||||||||
| 4080 | - | |||||||||||||||||||
| 4081 | /*! | - | ||||||||||||||||||
| 4082 | Holds the texture dimension \a direction. | - | ||||||||||||||||||
| 4083 | \overload | - | ||||||||||||||||||
| 4084 | */ | - | ||||||||||||||||||
| 4085 | void QOpenGLTexture::setWrapMode(QOpenGLTexture::CoordinateDirection direction, QOpenGLTexture::WrapMode mode) | - | ||||||||||||||||||
| 4086 | { | - | ||||||||||||||||||
| 4087 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4088 | d->create(); | - | ||||||||||||||||||
| 4089 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4090 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4091 | d->setWrapMode(direction, mode); | - | ||||||||||||||||||
| 4092 | } never executed: end of block | 0 | ||||||||||||||||||
| 4093 | - | |||||||||||||||||||
| 4094 | /*! | - | ||||||||||||||||||
| 4095 | Returns the wrap mode for the texture dimension \a direction. | - | ||||||||||||||||||
| 4096 | - | |||||||||||||||||||
| 4097 | \sa setWrapMode() | - | ||||||||||||||||||
| 4098 | */ | - | ||||||||||||||||||
| 4099 | QOpenGLTexture::WrapMode QOpenGLTexture::wrapMode(QOpenGLTexture::CoordinateDirection direction) const | - | ||||||||||||||||||
| 4100 | { | - | ||||||||||||||||||
| 4101 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4102 | return d->wrapMode(direction); never executed: return d->wrapMode(direction); | 0 | ||||||||||||||||||
| 4103 | } | - | ||||||||||||||||||
| 4104 | - | |||||||||||||||||||
| 4105 | /*! | - | ||||||||||||||||||
| 4106 | Sets the border color of the texture to \a color. | - | ||||||||||||||||||
| 4107 | - | |||||||||||||||||||
| 4108 | \note This function has no effect on Mac and Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 4109 | \sa borderColor() | - | ||||||||||||||||||
| 4110 | */ | - | ||||||||||||||||||
| 4111 | void QOpenGLTexture::setBorderColor(QColor color) | - | ||||||||||||||||||
| 4112 | { | - | ||||||||||||||||||
| 4113 | setBorderColor(static_cast<float>(color.redF()), static_cast<float>(color.greenF()), | - | ||||||||||||||||||
| 4114 | static_cast<float>(color.blueF()), static_cast<float>(color.alphaF())); | - | ||||||||||||||||||
| 4115 | } never executed: end of block | 0 | ||||||||||||||||||
| 4116 | - | |||||||||||||||||||
| 4117 | /*! | - | ||||||||||||||||||
| 4118 | Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and \a {a} to the | - | ||||||||||||||||||
| 4119 | alpha value. | - | ||||||||||||||||||
| 4120 | \overload | - | ||||||||||||||||||
| 4121 | */ | - | ||||||||||||||||||
| 4122 | void QOpenGLTexture::setBorderColor(float r, float g, float b, float a) | - | ||||||||||||||||||
| 4123 | { | - | ||||||||||||||||||
| 4124 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 4125 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 4126 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4127 | d->create(); | - | ||||||||||||||||||
| 4128 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4129 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4130 | float values[4]; | - | ||||||||||||||||||
| 4131 | values[0] = r; | - | ||||||||||||||||||
| 4132 | values[1] = g; | - | ||||||||||||||||||
| 4133 | values[2] = b; | - | ||||||||||||||||||
| 4134 | values[3] = a; | - | ||||||||||||||||||
| 4135 | d->borderColor.clear(); | - | ||||||||||||||||||
| 4136 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4137 | d->borderColor.append(QVariant(values[i])); never executed: d->borderColor.append(QVariant(values[i])); | 0 | ||||||||||||||||||
| 4138 | d->texFuncs->glTextureParameterfv(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_BORDER_COLOR, values); | - | ||||||||||||||||||
| 4139 | return; never executed: return; | 0 | ||||||||||||||||||
| 4140 | } | - | ||||||||||||||||||
| 4141 | #else | - | ||||||||||||||||||
| 4142 | Q_UNUSED(r); | - | ||||||||||||||||||
| 4143 | Q_UNUSED(g); | - | ||||||||||||||||||
| 4144 | Q_UNUSED(b); | - | ||||||||||||||||||
| 4145 | Q_UNUSED(a); | - | ||||||||||||||||||
| 4146 | #endif | - | ||||||||||||||||||
| 4147 | qWarning("QOpenGLTexture: Border color is not supported"); | - | ||||||||||||||||||
| 4148 | } never executed: end of block | 0 | ||||||||||||||||||
| 4149 | - | |||||||||||||||||||
| 4150 | /*! | - | ||||||||||||||||||
| 4151 | Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and the alpha | - | ||||||||||||||||||
| 4152 | value to \a {a}. | - | ||||||||||||||||||
| 4153 | \overload | - | ||||||||||||||||||
| 4154 | */ | - | ||||||||||||||||||
| 4155 | void QOpenGLTexture::setBorderColor(int r, int g, int b, int a) | - | ||||||||||||||||||
| 4156 | { | - | ||||||||||||||||||
| 4157 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 4158 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 4159 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4160 | d->create(); | - | ||||||||||||||||||
| 4161 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4162 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4163 | int values[4]; | - | ||||||||||||||||||
| 4164 | values[0] = r; | - | ||||||||||||||||||
| 4165 | values[1] = g; | - | ||||||||||||||||||
| 4166 | values[2] = b; | - | ||||||||||||||||||
| 4167 | values[3] = a; | - | ||||||||||||||||||
| 4168 | d->borderColor.clear(); | - | ||||||||||||||||||
| 4169 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4170 | d->borderColor.append(QVariant(values[i])); never executed: d->borderColor.append(QVariant(values[i])); | 0 | ||||||||||||||||||
| 4171 | d->texFuncs->glTextureParameteriv(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_BORDER_COLOR, values); | - | ||||||||||||||||||
| 4172 | return; never executed: return; | 0 | ||||||||||||||||||
| 4173 | } | - | ||||||||||||||||||
| 4174 | #else | - | ||||||||||||||||||
| 4175 | Q_UNUSED(r); | - | ||||||||||||||||||
| 4176 | Q_UNUSED(g); | - | ||||||||||||||||||
| 4177 | Q_UNUSED(b); | - | ||||||||||||||||||
| 4178 | Q_UNUSED(a); | - | ||||||||||||||||||
| 4179 | #endif | - | ||||||||||||||||||
| 4180 | qWarning("QOpenGLTexture: Border color is not supported"); | - | ||||||||||||||||||
| 4181 | - | |||||||||||||||||||
| 4182 | // TODO Handle case of using glTextureParameterIiv() based on format | - | ||||||||||||||||||
| 4183 | } never executed: end of block | 0 | ||||||||||||||||||
| 4184 | - | |||||||||||||||||||
| 4185 | /*! | - | ||||||||||||||||||
| 4186 | Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and the alpha | - | ||||||||||||||||||
| 4187 | value to \a {a}. | - | ||||||||||||||||||
| 4188 | \overload | - | ||||||||||||||||||
| 4189 | */ | - | ||||||||||||||||||
| 4190 | void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a) | - | ||||||||||||||||||
| 4191 | { | - | ||||||||||||||||||
| 4192 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 4193 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 4194 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4195 | d->create(); | - | ||||||||||||||||||
| 4196 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4197 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4198 | int values[4]; | - | ||||||||||||||||||
| 4199 | values[0] = int(r); | - | ||||||||||||||||||
| 4200 | values[1] = int(g); | - | ||||||||||||||||||
| 4201 | values[2] = int(b); | - | ||||||||||||||||||
| 4202 | values[3] = int(a); | - | ||||||||||||||||||
| 4203 | d->borderColor.clear(); | - | ||||||||||||||||||
| 4204 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4205 | d->borderColor.append(QVariant(values[i])); never executed: d->borderColor.append(QVariant(values[i])); | 0 | ||||||||||||||||||
| 4206 | d->texFuncs->glTextureParameteriv(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_BORDER_COLOR, values); | - | ||||||||||||||||||
| 4207 | return; never executed: return; | 0 | ||||||||||||||||||
| 4208 | } | - | ||||||||||||||||||
| 4209 | #else | - | ||||||||||||||||||
| 4210 | Q_UNUSED(r); | - | ||||||||||||||||||
| 4211 | Q_UNUSED(g); | - | ||||||||||||||||||
| 4212 | Q_UNUSED(b); | - | ||||||||||||||||||
| 4213 | Q_UNUSED(a); | - | ||||||||||||||||||
| 4214 | #endif | - | ||||||||||||||||||
| 4215 | qWarning("QOpenGLTexture: Border color is not supported"); | - | ||||||||||||||||||
| 4216 | - | |||||||||||||||||||
| 4217 | // TODO Handle case of using glTextureParameterIuiv() based on format | - | ||||||||||||||||||
| 4218 | } never executed: end of block | 0 | ||||||||||||||||||
| 4219 | - | |||||||||||||||||||
| 4220 | /*! | - | ||||||||||||||||||
| 4221 | Returns the borderColor of this texture. | - | ||||||||||||||||||
| 4222 | - | |||||||||||||||||||
| 4223 | \sa setBorderColor() | - | ||||||||||||||||||
| 4224 | */ | - | ||||||||||||||||||
| 4225 | QColor QOpenGLTexture::borderColor() const | - | ||||||||||||||||||
| 4226 | { | - | ||||||||||||||||||
| 4227 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4228 | QColor c(0.0f, 0.0f, 0.0f, 0.0f); | - | ||||||||||||||||||
| 4229 | if (!d->borderColor.isEmpty()) {
| 0 | ||||||||||||||||||
| 4230 | c.setRedF(d->borderColor.at(0).toFloat()); | - | ||||||||||||||||||
| 4231 | c.setGreenF(d->borderColor.at(1).toFloat()); | - | ||||||||||||||||||
| 4232 | c.setBlueF(d->borderColor.at(2).toFloat()); | - | ||||||||||||||||||
| 4233 | c.setAlphaF(d->borderColor.at(3).toFloat()); | - | ||||||||||||||||||
| 4234 | } never executed: end of block | 0 | ||||||||||||||||||
| 4235 | return c; never executed: return c; | 0 | ||||||||||||||||||
| 4236 | } | - | ||||||||||||||||||
| 4237 | - | |||||||||||||||||||
| 4238 | /*! | - | ||||||||||||||||||
| 4239 | Writes the texture border color into the first four elements | - | ||||||||||||||||||
| 4240 | of the array pointed to by \a border. | - | ||||||||||||||||||
| 4241 | - | |||||||||||||||||||
| 4242 | \sa setBorderColor() | - | ||||||||||||||||||
| 4243 | */ | - | ||||||||||||||||||
| 4244 | void QOpenGLTexture::borderColor(float *border) const | - | ||||||||||||||||||
| 4245 | { | - | ||||||||||||||||||
| 4246 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4247 | Q_ASSERT(border); | - | ||||||||||||||||||
| 4248 | if (d->borderColor.isEmpty()) {
| 0 | ||||||||||||||||||
| 4249 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4250 | border[i] = 0.0f; never executed: border[i] = 0.0f; | 0 | ||||||||||||||||||
| 4251 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 4252 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4253 | border[i] = d->borderColor.at(i).toFloat(); never executed: border[i] = d->borderColor.at(i).toFloat(); | 0 | ||||||||||||||||||
| 4254 | } never executed: end of block | 0 | ||||||||||||||||||
| 4255 | } | - | ||||||||||||||||||
| 4256 | - | |||||||||||||||||||
| 4257 | /*! | - | ||||||||||||||||||
| 4258 | Writes the texture border color into the first four elements | - | ||||||||||||||||||
| 4259 | of the array pointed to by \a border. | - | ||||||||||||||||||
| 4260 | - | |||||||||||||||||||
| 4261 | \overload | - | ||||||||||||||||||
| 4262 | */ | - | ||||||||||||||||||
| 4263 | void QOpenGLTexture::borderColor(int *border) const | - | ||||||||||||||||||
| 4264 | { | - | ||||||||||||||||||
| 4265 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4266 | Q_ASSERT(border); | - | ||||||||||||||||||
| 4267 | if (d->borderColor.isEmpty()) {
| 0 | ||||||||||||||||||
| 4268 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4269 | border[i] = 0; never executed: border[i] = 0; | 0 | ||||||||||||||||||
| 4270 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 4271 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4272 | border[i] = d->borderColor.at(i).toInt(); never executed: border[i] = d->borderColor.at(i).toInt(); | 0 | ||||||||||||||||||
| 4273 | } never executed: end of block | 0 | ||||||||||||||||||
| 4274 | } | - | ||||||||||||||||||
| 4275 | - | |||||||||||||||||||
| 4276 | /*! | - | ||||||||||||||||||
| 4277 | Writes the texture border color into the first four elements | - | ||||||||||||||||||
| 4278 | of the array pointed to by \a border. | - | ||||||||||||||||||
| 4279 | - | |||||||||||||||||||
| 4280 | \overload | - | ||||||||||||||||||
| 4281 | */ | - | ||||||||||||||||||
| 4282 | void QOpenGLTexture::borderColor(unsigned int *border) const | - | ||||||||||||||||||
| 4283 | { | - | ||||||||||||||||||
| 4284 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4285 | Q_ASSERT(border); | - | ||||||||||||||||||
| 4286 | if (d->borderColor.isEmpty()) {
| 0 | ||||||||||||||||||
| 4287 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4288 | border[i] = 0; never executed: border[i] = 0; | 0 | ||||||||||||||||||
| 4289 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 4290 | for (int i = 0; i < 4; ++i)
| 0 | ||||||||||||||||||
| 4291 | border[i] = d->borderColor.at(i).toUInt(); never executed: border[i] = d->borderColor.at(i).toUInt(); | 0 | ||||||||||||||||||
| 4292 | } never executed: end of block | 0 | ||||||||||||||||||
| 4293 | } | - | ||||||||||||||||||
| 4294 | - | |||||||||||||||||||
| 4295 | /*! | - | ||||||||||||||||||
| 4296 | Sets the minimum level of detail to \a value. This limits the selection of highest | - | ||||||||||||||||||
| 4297 | resolution mipmap (lowest mipmap level). The default value is -1000. | - | ||||||||||||||||||
| 4298 | - | |||||||||||||||||||
| 4299 | \note This function has no effect on Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 4300 | \sa minimumLevelOfDetail(), setMaximumLevelOfDetail(), setLevelOfDetailRange() | - | ||||||||||||||||||
| 4301 | */ | - | ||||||||||||||||||
| 4302 | void QOpenGLTexture::setMinimumLevelOfDetail(float value) | - | ||||||||||||||||||
| 4303 | { | - | ||||||||||||||||||
| 4304 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 4305 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 4306 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4307 | d->create(); | - | ||||||||||||||||||
| 4308 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4309 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4310 | Q_ASSERT(value < d->maxLevelOfDetail); | - | ||||||||||||||||||
| 4311 | d->minLevelOfDetail = value; | - | ||||||||||||||||||
| 4312 | d->texFuncs->glTextureParameterf(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MIN_LOD, value); | - | ||||||||||||||||||
| 4313 | return; never executed: return; | 0 | ||||||||||||||||||
| 4314 | } | - | ||||||||||||||||||
| 4315 | #else | - | ||||||||||||||||||
| 4316 | Q_UNUSED(value); | - | ||||||||||||||||||
| 4317 | #endif | - | ||||||||||||||||||
| 4318 | qWarning("QOpenGLTexture: Detail level is not supported"); | - | ||||||||||||||||||
| 4319 | } never executed: end of block | 0 | ||||||||||||||||||
| 4320 | - | |||||||||||||||||||
| 4321 | /*! | - | ||||||||||||||||||
| 4322 | Returns the minimum level of detail parameter. | - | ||||||||||||||||||
| 4323 | - | |||||||||||||||||||
| 4324 | \sa setMinimumLevelOfDetail(), maximumLevelOfDetail(), levelOfDetailRange() | - | ||||||||||||||||||
| 4325 | */ | - | ||||||||||||||||||
| 4326 | float QOpenGLTexture::minimumLevelOfDetail() const | - | ||||||||||||||||||
| 4327 | { | - | ||||||||||||||||||
| 4328 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4329 | return d->minLevelOfDetail; never executed: return d->minLevelOfDetail; | 0 | ||||||||||||||||||
| 4330 | } | - | ||||||||||||||||||
| 4331 | - | |||||||||||||||||||
| 4332 | /*! | - | ||||||||||||||||||
| 4333 | Sets the maximum level of detail to \a value. This limits the selection of lowest | - | ||||||||||||||||||
| 4334 | resolution mipmap (highest mipmap level). The default value is 1000. | - | ||||||||||||||||||
| 4335 | - | |||||||||||||||||||
| 4336 | \note This function has no effect on Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 4337 | \sa maximumLevelOfDetail(), setMinimumLevelOfDetail(), setLevelOfDetailRange() | - | ||||||||||||||||||
| 4338 | */ | - | ||||||||||||||||||
| 4339 | void QOpenGLTexture::setMaximumLevelOfDetail(float value) | - | ||||||||||||||||||
| 4340 | { | - | ||||||||||||||||||
| 4341 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 4342 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 4343 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4344 | d->create(); | - | ||||||||||||||||||
| 4345 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4346 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4347 | Q_ASSERT(value > d->minLevelOfDetail); | - | ||||||||||||||||||
| 4348 | d->maxLevelOfDetail = value; | - | ||||||||||||||||||
| 4349 | d->texFuncs->glTextureParameterf(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAX_LOD, value); | - | ||||||||||||||||||
| 4350 | return; never executed: return; | 0 | ||||||||||||||||||
| 4351 | } | - | ||||||||||||||||||
| 4352 | #else | - | ||||||||||||||||||
| 4353 | Q_UNUSED(value); | - | ||||||||||||||||||
| 4354 | #endif | - | ||||||||||||||||||
| 4355 | qWarning("QOpenGLTexture: Detail level is not supported"); | - | ||||||||||||||||||
| 4356 | } never executed: end of block | 0 | ||||||||||||||||||
| 4357 | - | |||||||||||||||||||
| 4358 | /*! | - | ||||||||||||||||||
| 4359 | Returns the maximum level of detail parameter. | - | ||||||||||||||||||
| 4360 | - | |||||||||||||||||||
| 4361 | \sa setMaximumLevelOfDetail(), minimumLevelOfDetail(), levelOfDetailRange() | - | ||||||||||||||||||
| 4362 | */ | - | ||||||||||||||||||
| 4363 | float QOpenGLTexture::maximumLevelOfDetail() const | - | ||||||||||||||||||
| 4364 | { | - | ||||||||||||||||||
| 4365 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4366 | return d->maxLevelOfDetail; never executed: return d->maxLevelOfDetail; | 0 | ||||||||||||||||||
| 4367 | } | - | ||||||||||||||||||
| 4368 | - | |||||||||||||||||||
| 4369 | /*! | - | ||||||||||||||||||
| 4370 | Sets the minimum level of detail parameters to \a min and the maximum level | - | ||||||||||||||||||
| 4371 | to \a max. | - | ||||||||||||||||||
| 4372 | \note This function has no effect on Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 4373 | \sa levelOfDetailRange(), setMinimumLevelOfDetail(), setMaximumLevelOfDetail() | - | ||||||||||||||||||
| 4374 | */ | - | ||||||||||||||||||
| 4375 | void QOpenGLTexture::setLevelOfDetailRange(float min, float max) | - | ||||||||||||||||||
| 4376 | { | - | ||||||||||||||||||
| 4377 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 4378 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 4379 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4380 | d->create(); | - | ||||||||||||||||||
| 4381 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4382 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4383 | Q_ASSERT(min < max); | - | ||||||||||||||||||
| 4384 | d->minLevelOfDetail = min; | - | ||||||||||||||||||
| 4385 | d->maxLevelOfDetail = max; | - | ||||||||||||||||||
| 4386 | d->texFuncs->glTextureParameterf(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MIN_LOD, min); | - | ||||||||||||||||||
| 4387 | d->texFuncs->glTextureParameterf(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_MAX_LOD, max); | - | ||||||||||||||||||
| 4388 | return; never executed: return; | 0 | ||||||||||||||||||
| 4389 | } | - | ||||||||||||||||||
| 4390 | #else | - | ||||||||||||||||||
| 4391 | Q_UNUSED(min); | - | ||||||||||||||||||
| 4392 | Q_UNUSED(max); | - | ||||||||||||||||||
| 4393 | #endif | - | ||||||||||||||||||
| 4394 | qWarning("QOpenGLTexture: Detail level is not supported"); | - | ||||||||||||||||||
| 4395 | } never executed: end of block | 0 | ||||||||||||||||||
| 4396 | - | |||||||||||||||||||
| 4397 | /*! | - | ||||||||||||||||||
| 4398 | Returns the minimum and maximum level of detail parameters. | - | ||||||||||||||||||
| 4399 | - | |||||||||||||||||||
| 4400 | \sa setLevelOfDetailRange(), minimumLevelOfDetail(), maximumLevelOfDetail() | - | ||||||||||||||||||
| 4401 | */ | - | ||||||||||||||||||
| 4402 | QPair<float, float> QOpenGLTexture::levelOfDetailRange() const | - | ||||||||||||||||||
| 4403 | { | - | ||||||||||||||||||
| 4404 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4405 | return qMakePair(d->minLevelOfDetail, d->maxLevelOfDetail); never executed: return qMakePair(d->minLevelOfDetail, d->maxLevelOfDetail); | 0 | ||||||||||||||||||
| 4406 | } | - | ||||||||||||||||||
| 4407 | - | |||||||||||||||||||
| 4408 | /*! | - | ||||||||||||||||||
| 4409 | Sets the level of detail bias to \a bias. | - | ||||||||||||||||||
| 4410 | Level of detail bias affects the point at which mipmapping levels change. | - | ||||||||||||||||||
| 4411 | Increasing values for level of detail bias makes the overall images blurrier | - | ||||||||||||||||||
| 4412 | or smoother. Decreasing values make the overall images sharper. | - | ||||||||||||||||||
| 4413 | - | |||||||||||||||||||
| 4414 | \note This function has no effect on Qt built for OpenGL ES 2. | - | ||||||||||||||||||
| 4415 | \sa levelofDetailBias() | - | ||||||||||||||||||
| 4416 | */ | - | ||||||||||||||||||
| 4417 | void QOpenGLTexture::setLevelofDetailBias(float bias) | - | ||||||||||||||||||
| 4418 | { | - | ||||||||||||||||||
| 4419 | #if !defined(QT_OPENGL_ES_2) | - | ||||||||||||||||||
| 4420 | if (!QOpenGLContext::currentContext()->isOpenGLES()) {
| 0 | ||||||||||||||||||
| 4421 | Q_D(QOpenGLTexture); | - | ||||||||||||||||||
| 4422 | d->create(); | - | ||||||||||||||||||
| 4423 | Q_ASSERT(d->texFuncs); | - | ||||||||||||||||||
| 4424 | Q_ASSERT(d->textureId); | - | ||||||||||||||||||
| 4425 | d->levelOfDetailBias = bias; | - | ||||||||||||||||||
| 4426 | d->texFuncs->glTextureParameterf(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_LOD_BIAS, bias); | - | ||||||||||||||||||
| 4427 | return; never executed: return; | 0 | ||||||||||||||||||
| 4428 | } | - | ||||||||||||||||||
| 4429 | #else | - | ||||||||||||||||||
| 4430 | Q_UNUSED(bias); | - | ||||||||||||||||||
| 4431 | #endif | - | ||||||||||||||||||
| 4432 | qWarning("QOpenGLTexture: Detail level is not supported"); | - | ||||||||||||||||||
| 4433 | } never executed: end of block | 0 | ||||||||||||||||||
| 4434 | - | |||||||||||||||||||
| 4435 | /*! | - | ||||||||||||||||||
| 4436 | Returns the level of detail bias parameter. | - | ||||||||||||||||||
| 4437 | - | |||||||||||||||||||
| 4438 | \sa setLevelofDetailBias() | - | ||||||||||||||||||
| 4439 | */ | - | ||||||||||||||||||
| 4440 | float QOpenGLTexture::levelofDetailBias() const | - | ||||||||||||||||||
| 4441 | { | - | ||||||||||||||||||
| 4442 | Q_D(const QOpenGLTexture); | - | ||||||||||||||||||
| 4443 | return d->levelOfDetailBias; never executed: return d->levelOfDetailBias; | 0 | ||||||||||||||||||
| 4444 | } | - | ||||||||||||||||||
| 4445 | - | |||||||||||||||||||
| 4446 | QT_END_NAMESPACE | - | ||||||||||||||||||
| Source code | Switch to Preprocessed file |