| 1 | /**************************************************************************** | 
| 2 | ** | 
| 3 | ** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB). | 
| 4 | ** Contact: https://www.qt.io/licensing/ | 
| 5 | ** | 
| 6 | ** This file is part of the Qt3D 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 "qrendercapabilities.h" | 
| 41 | #include "qrendercapabilities_p.h" | 
| 42 |  | 
| 43 | #include <QOffscreenSurface> | 
| 44 | #include <QOpenGLContext> | 
| 45 | #include <QOpenGLFunctions> | 
| 46 | #include <QOpenGLExtraFunctions> | 
| 47 | #include <QSet> | 
| 48 | #include <QDebug> | 
| 49 |  | 
| 50 | #ifndef GL_MAX_UNIFORM_BLOCK_SIZE | 
| 51 | #define GL_MAX_UNIFORM_BLOCK_SIZE               0x8A30 | 
| 52 | #endif | 
| 53 |  | 
| 54 | #ifndef GL_MAX_UNIFORM_BLOCK_SIZE | 
| 55 | #define GL_MAX_UNIFORM_BLOCK_SIZE               0x8A30 | 
| 56 | #endif | 
| 57 |  | 
| 58 | #ifndef GL_MAX_SAMPLES | 
| 59 | #define GL_MAX_SAMPLES                          0x8D57 | 
| 60 | #endif | 
| 61 |  | 
| 62 | #ifndef GL_MAX_UNIFORM_BUFFER_BINDINGS | 
| 63 | #define GL_MAX_UNIFORM_BUFFER_BINDINGS          0x8A2F | 
| 64 | #endif | 
| 65 |  | 
| 66 | #ifndef GL_MAX_UNIFORM_BLOCK_SIZE | 
| 67 | #define GL_MAX_UNIFORM_BLOCK_SIZE               0x8A30 | 
| 68 | #endif | 
| 69 |  | 
| 70 | #ifndef GL_MAX_ARRAY_TEXTURE_LAYERS | 
| 71 | #define GL_MAX_ARRAY_TEXTURE_LAYERS             0x88FF | 
| 72 | #endif | 
| 73 |  | 
| 74 | #ifndef GL_MAX_IMAGE_UNITS | 
| 75 | #define GL_MAX_IMAGE_UNITS                      0x8F38 | 
| 76 | #endif | 
| 77 |  | 
| 78 | #ifndef GL_MAX_SHADER_STORAGE_BLOCK_SIZE | 
| 79 | #define GL_MAX_SHADER_STORAGE_BLOCK_SIZE        0x90DE | 
| 80 | #endif | 
| 81 |  | 
| 82 | #ifndef GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS | 
| 83 | #define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS   0x90DD | 
| 84 | #endif | 
| 85 |  | 
| 86 | #ifndef GL_MAX_COMPUTE_WORK_GROUP_SIZE | 
| 87 | #define GL_MAX_COMPUTE_WORK_GROUP_SIZE          0x91BF | 
| 88 | #endif | 
| 89 |  | 
| 90 | #ifndef GL_MAX_COMPUTE_WORK_GROUP_COUNT | 
| 91 | #define GL_MAX_COMPUTE_WORK_GROUP_COUNT         0x91BE | 
| 92 | #endif | 
| 93 |  | 
| 94 | #ifndef GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS | 
| 95 | #define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS   0x90EB | 
| 96 | #endif | 
| 97 |  | 
| 98 | #ifndef GL_MAX_COMPUTE_SHARED_MEMORY_SIZE | 
| 99 | #define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE       0x8262 | 
| 100 | #endif | 
| 101 |  | 
| 102 |  | 
| 103 | QT_BEGIN_NAMESPACE | 
| 104 |  | 
| 105 | namespace Qt3DRender { | 
| 106 |  | 
| 107 | /*! | 
| 108 |    \class Qt3DRender::QRenderCapabilities | 
| 109 |    \brief The QRenderCapabilities class holds settings related to available rendering engines | 
| 110 |  | 
| 111 | QRenderCapabilities provides details of graphical features that are available at runtime. | 
| 112 | It can be used to decide which code path to use for some algorithms, for example, depending | 
| 113 | on whether compute shaders are available or not. | 
| 114 |  | 
| 115 | \since 5.15 | 
| 116 | */ | 
| 117 |  | 
| 118 | /*! | 
| 119 |    \qmltype RenderCapabilities | 
| 120 |    \brief The QRenderCapabilities class holds settings related to available rendering engines | 
| 121 |    \since 5.15 | 
| 122 |    \inqmlmodule Qt3D.Render | 
| 123 |    \instantiates Qt3DRender::QRenderCapabilities | 
| 124 |  | 
| 125 | RenderCapabilities provides details of graphical features that are available at runtime. | 
| 126 | It can be used to decide which code path to use for some algorithms, for example, depending | 
| 127 | on whether compute shaders are available or not. | 
| 128 |  | 
| 129 | \since 5.15 | 
| 130 | */ | 
| 131 |  | 
| 132 |  | 
| 133 | /*! \internal */ | 
| 134 | QRenderCapabilitiesPrivate::QRenderCapabilitiesPrivate() | 
| 135 |     : QObjectPrivate() | 
| 136 |     , m_valid(false) | 
| 137 | { | 
| 138 |     QOffscreenSurface offscreen; | 
| 139 |     QOpenGLContext ctx; | 
| 140 |  | 
| 141 |     offscreen.setFormat(QSurfaceFormat::defaultFormat()); | 
| 142 |     offscreen.create(); | 
| 143 |     Q_ASSERT_X(offscreen.isValid(), Q_FUNC_INFO, "Unable to create offscreen surface to gather capabilities" ); | 
| 144 |  | 
| 145 |     ctx.setFormat(QSurfaceFormat::defaultFormat()); | 
| 146 |     if (ctx.create()) { | 
| 147 |         m_valid = true; | 
| 148 |         ctx.makeCurrent(surface: &offscreen); | 
| 149 |         const QSurfaceFormat format = ctx.format(); | 
| 150 |         auto funcs = ctx.functions(); | 
| 151 |  | 
| 152 |         if (ctx.isOpenGLES()) | 
| 153 |             m_api = QRenderCapabilities::OpenGLES; | 
| 154 |         else | 
| 155 |             m_api = QRenderCapabilities::OpenGL; | 
| 156 |         m_profile = static_cast<QRenderCapabilities::Profile>(format.profile()); | 
| 157 |         m_majorVersion = format.majorVersion(); | 
| 158 |         m_minorVersion = format.minorVersion(); | 
| 159 |         const QSet<QByteArray> extensions = ctx.extensions(); | 
| 160 |         std::transform(first: std::begin(cont: extensions), last: std::end(cont: extensions), result: std::back_inserter(x&: m_extensions), unary_op: [](const QByteArray &e) { | 
| 161 |             return QLatin1String(e.data()); | 
| 162 |         }); | 
| 163 |         std::sort(first: std::begin(cont&: m_extensions), last: std::end(cont&: m_extensions)); | 
| 164 |         m_vendor = QString::fromUtf8(str: reinterpret_cast<const char *>(funcs->glGetString(GL_VENDOR))); | 
| 165 |         m_renderer = QString::fromUtf8(str: reinterpret_cast<const char *>(funcs->glGetString(GL_RENDERER))); | 
| 166 |         m_version = QString::fromUtf8(str: reinterpret_cast<const char *>(funcs->glGetString(GL_VERSION))); | 
| 167 |         m_glslVersion = QString::fromUtf8(str: reinterpret_cast<const char *>(funcs->glGetString(GL_SHADING_LANGUAGE_VERSION))); | 
| 168 |  | 
| 169 |         funcs->glGetIntegerv(GL_MAX_SAMPLES, params: &m_maxSamples); | 
| 170 |         funcs->glGetIntegerv(GL_MAX_TEXTURE_SIZE, params: &m_maxTextureSize); | 
| 171 |         funcs->glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, params: &m_maxTextureUnits); | 
| 172 |  | 
| 173 |         if (m_majorVersion >= 3) { | 
| 174 |             if (m_minorVersion >= 1) { | 
| 175 |                 m_supportsUBO = true; | 
| 176 |                 funcs->glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, params: &m_maxUBOSize); | 
| 177 |                 funcs->glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, params: &m_maxUBOBindings); | 
| 178 |             } | 
| 179 |  | 
| 180 |             funcs->glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, params: &m_maxTextureLayers); | 
| 181 |         } | 
| 182 |         if ((m_api == QRenderCapabilities::OpenGL && m_majorVersion >= 4 && m_minorVersion >= 3) || | 
| 183 |             (m_api == QRenderCapabilities::OpenGLES && m_majorVersion >= 3 && m_minorVersion >= 2)) { | 
| 184 |             m_supportsSSBO = true; | 
| 185 |             m_supportCompute = true; | 
| 186 |             m_supportsImageStore = true; | 
| 187 |             funcs->glGetIntegerv(GL_MAX_IMAGE_UNITS, params: &m_maxImageUnits); | 
| 188 |             m_supportsSSBO = true; | 
| 189 |             funcs->glGetIntegerv(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, params: &m_maxSSBOSize); | 
| 190 |             funcs->glGetIntegerv(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, params: &m_maxSSBOBindings); | 
| 191 |  | 
| 192 |             QOpenGLExtraFunctions *exfunc = nullptr; | 
| 193 |             if ((exfunc = ctx.extraFunctions()) != nullptr) { | 
| 194 |                 for (int i = 0; i < 3; ++i) { | 
| 195 |                     exfunc->glGetIntegeri_v( GL_MAX_COMPUTE_WORK_GROUP_SIZE, index: i, data: &m_maxWorkGroupSize[i] ); | 
| 196 |                     exfunc->glGetIntegeri_v( GL_MAX_COMPUTE_WORK_GROUP_COUNT, index: i, data: &m_maxWorkGroupCount[i] ); | 
| 197 |                 } | 
| 198 |             } | 
| 199 |  | 
| 200 |             funcs->glGetIntegerv( GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS, params: &m_maxComputeInvocations ); | 
| 201 |             funcs->glGetIntegerv( GL_MAX_COMPUTE_SHARED_MEMORY_SIZE, params: &m_maxComputeSharedMemorySize ); | 
| 202 |         } | 
| 203 |  | 
| 204 |         // TextureUnitCount, ImageUnitCount, ComputeSupport, ImageSupport, SSBO Support, UBO Support, extensions, Max RenderTargetCount would be a good start | 
| 205 |     } | 
| 206 | } | 
| 207 |  | 
| 208 | const QRenderCapabilitiesPrivate *QRenderCapabilitiesPrivate::get(const QRenderCapabilities *q) | 
| 209 | { | 
| 210 |     return q->d_func(); | 
| 211 | } | 
| 212 |  | 
| 213 | QString QRenderCapabilitiesPrivate::toString() const | 
| 214 | { | 
| 215 |     QString res; | 
| 216 |  | 
| 217 |     res += QString(QLatin1String("Vendor: %1\nRenderer: %2\nDriver Version: %3\nGL Version: %4.%5 (%6 Profile)\nGLSL Version: %7\n" )) | 
| 218 |                .arg(a1: m_vendor, a2: m_renderer, a3: m_version) | 
| 219 |                .arg(a: m_majorVersion).arg(a: m_minorVersion) | 
| 220 |                .arg(a: m_profile == QRenderCapabilities::CoreProfile ? QLatin1String("Core" ) : (m_profile == QRenderCapabilities::CompatibilityProfile ? QLatin1String("Compatibility" ) : QLatin1String("No" ))) | 
| 221 |                .arg(a: m_glslVersion); | 
| 222 |     res += QString(QLatin1String("Extensions:\n  %1\n" )).arg(a: m_extensions.join(sep: QLatin1String("\n  " ))); | 
| 223 |     res += QString(QLatin1String("Max Texture Size: %1\nMax Texture Units: %2\nMax Texture Layers: %3\n" )).arg(a: m_maxTextureSize).arg(a: m_maxTextureUnits).arg(a: m_maxTextureLayers); | 
| 224 |     res += QString(QLatin1String("Supports UBO: %1\n" )).arg(a: m_supportsUBO ? QLatin1String("True" ) : QLatin1String("False" )); | 
| 225 |     if (m_supportsUBO) | 
| 226 |         res += QString(QLatin1String("  Max UBO Size: %1\n  Max UBO Bindings: %2\n" )).arg(a: m_maxUBOSize).arg(a: m_maxUBOBindings); | 
| 227 |     res += QString(QLatin1String("Supports SSBO: %1\n" )).arg(a: m_supportsSSBO ? QLatin1String("True" ) : QLatin1String("False" )); | 
| 228 |     if (m_supportsSSBO) | 
| 229 |         res += QString(QLatin1String("  Max SSBO Size: %1\n  Max SSBO Bindings: %2\n" )).arg(a: m_maxSSBOSize).arg(a: m_maxSSBOBindings); | 
| 230 |     res += QString(QLatin1String("Supports Image Store: %1\n" )).arg(a: m_supportsImageStore ? QLatin1String("True" ) : QLatin1String("False" )); | 
| 231 |     if (m_supportsImageStore) | 
| 232 |         res += QString(QLatin1String("  Max Image Units: %1\n" )).arg(a: m_maxImageUnits); | 
| 233 |     res += QString(QLatin1String("Supports Compute Shaders: %1\n" )).arg(a: m_supportCompute ? QLatin1String("True" ) : QLatin1String("False" )); | 
| 234 |     if (m_supportCompute) | 
| 235 |         res += QString(QLatin1String("  Max Work Group Size: %1, %2, %3\n  Max Work Group Count: %4, %5, %6\n  Max Invocations: %7\n  Max Shared Memory Size: %8\n" )) | 
| 236 |                    .arg(a: m_maxWorkGroupSize[0]).arg(a: m_maxWorkGroupSize[1]).arg(a: m_maxWorkGroupSize[2]) | 
| 237 |                    .arg(a: m_maxWorkGroupCount[0]).arg(a: m_maxWorkGroupCount[1]).arg(a: m_maxWorkGroupCount[2]) | 
| 238 |                    .arg(a: m_maxComputeInvocations).arg(a: m_maxComputeSharedMemorySize); | 
| 239 |     return res; | 
| 240 | } | 
| 241 |  | 
| 242 |  | 
| 243 | QRenderCapabilities::QRenderCapabilities(QObject *parent) | 
| 244 |     : QObject(*new QRenderCapabilitiesPrivate, parent) | 
| 245 | { | 
| 246 |  | 
| 247 | } | 
| 248 |  | 
| 249 | /*! \internal */ | 
| 250 | QRenderCapabilities::~QRenderCapabilities() | 
| 251 | { | 
| 252 | } | 
| 253 |  | 
| 254 |  | 
| 255 | /*! | 
| 256 | \qmlproperty bool RenderCapabilities::valid | 
| 257 |  | 
| 258 | true if the data is valid, otherwise Qt 3D failed to query the available hardware. | 
| 259 |  | 
| 260 | \readonly | 
| 261 | */ | 
| 262 | /*! | 
| 263 | \property QRenderCapabilities::valid | 
| 264 |  | 
| 265 | true if the data is valid, otherwise Qt 3D failed to query the available hardware. | 
| 266 |  | 
| 267 | \readonly | 
| 268 | */ | 
| 269 | bool QRenderCapabilities::isValid() const | 
| 270 | { | 
| 271 |     Q_D(const QRenderCapabilities); | 
| 272 |     return d->m_valid; | 
| 273 | } | 
| 274 |  | 
| 275 | /*! | 
| 276 | \qmlproperty QRenderCapabilities::API RenderCapabilities::api | 
| 277 |  | 
| 278 | Returns which API is currently in use. | 
| 279 |  | 
| 280 | \readonly | 
| 281 | */ | 
| 282 | /*! | 
| 283 | \property QRenderCapabilities::api | 
| 284 |  | 
| 285 | Returns which API is currently in use. | 
| 286 |  | 
| 287 | \readonly | 
| 288 | */ | 
| 289 | QRenderCapabilities::API QRenderCapabilities::api() const | 
| 290 | { | 
| 291 |     Q_D(const QRenderCapabilities); | 
| 292 |     return d->m_api; | 
| 293 | } | 
| 294 |  | 
| 295 | /*! | 
| 296 | \qmlproperty bool RenderCapabilities::profile | 
| 297 |  | 
| 298 | Returns which profile (if applicable) is currently in use. | 
| 299 |  | 
| 300 | \readonly | 
| 301 | */ | 
| 302 | /*! | 
| 303 | \property QRenderCapabilities::profile | 
| 304 |  | 
| 305 | Returns which profile (if applicable) is currently in use. | 
| 306 |  | 
| 307 | \readonly | 
| 308 | */ | 
| 309 | QRenderCapabilities::Profile QRenderCapabilities::profile() const | 
| 310 | { | 
| 311 |     Q_D(const QRenderCapabilities); | 
| 312 |     return d->m_profile; | 
| 313 | } | 
| 314 |  | 
| 315 | /*! | 
| 316 | \qmlproperty int RenderCapabilities::majorVersion | 
| 317 |  | 
| 318 | Returns the major version number currently in use. | 
| 319 |  | 
| 320 | \readonly | 
| 321 | */ | 
| 322 | /*! | 
| 323 | \property QRenderCapabilities::majorVersion | 
| 324 |  | 
| 325 | Returns the major version number currently in use. | 
| 326 |  | 
| 327 | \readonly | 
| 328 | */ | 
| 329 | int QRenderCapabilities::majorVersion() const | 
| 330 | { | 
| 331 |     Q_D(const QRenderCapabilities); | 
| 332 |     return d->m_majorVersion; | 
| 333 | } | 
| 334 |  | 
| 335 | /*! | 
| 336 | \qmlproperty int RenderCapabilities::minorVersion | 
| 337 |  | 
| 338 | Returns the minor version number currently in use. | 
| 339 |  | 
| 340 | \readonly | 
| 341 | */ | 
| 342 | /*! | 
| 343 | \property QRenderCapabilities::minorVersion | 
| 344 |  | 
| 345 | Returns the minor version number currently in use. | 
| 346 |  | 
| 347 | \readonly | 
| 348 | */ | 
| 349 | int QRenderCapabilities::minorVersion() const | 
| 350 | { | 
| 351 |     Q_D(const QRenderCapabilities); | 
| 352 |     return d->m_minorVersion; | 
| 353 | } | 
| 354 |  | 
| 355 | /*! | 
| 356 | \qmlproperty QStringList RenderCapabilities::extensions | 
| 357 |  | 
| 358 | Returns the list of extensions currently available. | 
| 359 |  | 
| 360 | \readonly | 
| 361 | */ | 
| 362 | /*! | 
| 363 | \property QRenderCapabilities::extensions | 
| 364 |  | 
| 365 | Returns the list of extensions currently available. | 
| 366 |  | 
| 367 | \readonly | 
| 368 | */ | 
| 369 | QStringList QRenderCapabilities::extensions() const | 
| 370 | { | 
| 371 |     Q_D(const QRenderCapabilities); | 
| 372 |     return d->m_extensions; | 
| 373 | } | 
| 374 |  | 
| 375 | /*! | 
| 376 | \qmlproperty QString RenderCapabilities::vendor | 
| 377 |  | 
| 378 | Returns the vendor identification string. | 
| 379 |  | 
| 380 | \readonly | 
| 381 | */ | 
| 382 | /*! | 
| 383 | \property QRenderCapabilities::vendor | 
| 384 |  | 
| 385 | Returns the vendor identification string. | 
| 386 |  | 
| 387 | \readonly | 
| 388 | */ | 
| 389 | QString QRenderCapabilities::vendor() const | 
| 390 | { | 
| 391 |     Q_D(const QRenderCapabilities); | 
| 392 |     return d->m_vendor; | 
| 393 | } | 
| 394 |  | 
| 395 | /*! | 
| 396 | \qmlproperty QString RenderCapabilities::renderer | 
| 397 |  | 
| 398 | Returns the device identification string. | 
| 399 |  | 
| 400 | \readonly | 
| 401 | */ | 
| 402 | /*! | 
| 403 | \property QRenderCapabilities::renderer | 
| 404 |  | 
| 405 | Returns the device identification string. | 
| 406 |  | 
| 407 | \readonly | 
| 408 | */ | 
| 409 | QString QRenderCapabilities::renderer() const | 
| 410 | { | 
| 411 |     Q_D(const QRenderCapabilities); | 
| 412 |     return d->m_renderer; | 
| 413 | } | 
| 414 |  | 
| 415 | /*! | 
| 416 | \qmlproperty QString RenderCapabilities::driverVersion | 
| 417 |  | 
| 418 | Returns the driver version string. | 
| 419 |  | 
| 420 | \readonly | 
| 421 | */ | 
| 422 | /*! | 
| 423 | \property QRenderCapabilities::driverVersion | 
| 424 |  | 
| 425 | Returns the driver version string. | 
| 426 |  | 
| 427 | \readonly | 
| 428 | */ | 
| 429 | QString QRenderCapabilities::driverVersion() const | 
| 430 | { | 
| 431 |     Q_D(const QRenderCapabilities); | 
| 432 |     return d->m_version; | 
| 433 | } | 
| 434 |  | 
| 435 | /*! | 
| 436 | \qmlproperty QString RenderCapabilities::glslVersion | 
| 437 |  | 
| 438 | Returns the GLSL version string. | 
| 439 |  | 
| 440 | \readonly | 
| 441 | */ | 
| 442 | /*! | 
| 443 | \property QRenderCapabilities::glslVersion | 
| 444 |  | 
| 445 | Returns the GLSL version string. | 
| 446 |  | 
| 447 | \readonly | 
| 448 | */ | 
| 449 | QString QRenderCapabilities::glslVersion() const | 
| 450 | { | 
| 451 |     Q_D(const QRenderCapabilities); | 
| 452 |     return d->m_glslVersion; | 
| 453 | } | 
| 454 |  | 
| 455 | /*! | 
| 456 | \qmlproperty int RenderCapabilities::maxSamples | 
| 457 |  | 
| 458 | Returns the maximum number of samples available for MSAA. | 
| 459 |  | 
| 460 | \readonly | 
| 461 | */ | 
| 462 | /*! | 
| 463 | \property QRenderCapabilities::maxSamples | 
| 464 |  | 
| 465 | Returns the maximum number of samples available for MSAA. | 
| 466 |  | 
| 467 | \readonly | 
| 468 | */ | 
| 469 | int QRenderCapabilities::maxSamples() const | 
| 470 | { | 
| 471 |     Q_D(const QRenderCapabilities); | 
| 472 |     return d->m_maxSamples; | 
| 473 | } | 
| 474 |  | 
| 475 | /*! | 
| 476 | \qmlproperty int RenderCapabilities::maxTextureSize | 
| 477 |  | 
| 478 | Returns the maximum size of textures. | 
| 479 |  | 
| 480 | \readonly | 
| 481 | */ | 
| 482 | /*! | 
| 483 | \property QRenderCapabilities::maxTextureSize | 
| 484 |  | 
| 485 | Returns the maximum size of textures. | 
| 486 |  | 
| 487 | \readonly | 
| 488 | */ | 
| 489 | int QRenderCapabilities::maxTextureSize() const | 
| 490 | { | 
| 491 |     Q_D(const QRenderCapabilities); | 
| 492 |     return d->m_maxTextureSize; | 
| 493 | } | 
| 494 |  | 
| 495 | /*! | 
| 496 | \qmlproperty int RenderCapabilities::maxTextureUnits | 
| 497 |  | 
| 498 | Returns the number of available texture units. | 
| 499 |  | 
| 500 | \readonly | 
| 501 | */ | 
| 502 | /*! | 
| 503 | \property QRenderCapabilities::maxTextureUnits | 
| 504 |  | 
| 505 | Returns the number of available texture units. | 
| 506 |  | 
| 507 | \readonly | 
| 508 | */ | 
| 509 | int QRenderCapabilities::maxTextureUnits() const | 
| 510 | { | 
| 511 |     Q_D(const QRenderCapabilities); | 
| 512 |     return d->m_maxTextureUnits; | 
| 513 | } | 
| 514 |  | 
| 515 | /*! | 
| 516 | \qmlproperty int RenderCapabilities::maxTextureLayers | 
| 517 |  | 
| 518 | Returns the number of available texture layers. | 
| 519 |  | 
| 520 | \readonly | 
| 521 | */ | 
| 522 | /*! | 
| 523 | \property QRenderCapabilities::maxTextureLayers | 
| 524 |  | 
| 525 | Returns the number of available texture layers. | 
| 526 |  | 
| 527 | \readonly | 
| 528 | */ | 
| 529 | int QRenderCapabilities::maxTextureLayers() const | 
| 530 | { | 
| 531 |     Q_D(const QRenderCapabilities); | 
| 532 |     return d->m_maxTextureLayers; | 
| 533 | } | 
| 534 |  | 
| 535 | /*! | 
| 536 | \qmlproperty bool RenderCapabilities::supportsUBO | 
| 537 |  | 
| 538 | Returns true if UBOs are supported. | 
| 539 |  | 
| 540 | \readonly | 
| 541 | */ | 
| 542 | /*! | 
| 543 | \property QRenderCapabilities::supportsUBO | 
| 544 |  | 
| 545 | Returns true if UBOs are supported. | 
| 546 |  | 
| 547 | \readonly | 
| 548 | */ | 
| 549 | bool QRenderCapabilities::supportsUBO() const | 
| 550 | { | 
| 551 |     Q_D(const QRenderCapabilities); | 
| 552 |     return d->m_supportsUBO; | 
| 553 | } | 
| 554 |  | 
| 555 | /*! | 
| 556 | \qmlproperty int RenderCapabilities::maxUBOSize | 
| 557 |  | 
| 558 | Returns the maximum size of UBOs, if supported. | 
| 559 |  | 
| 560 | \readonly | 
| 561 | */ | 
| 562 | /*! | 
| 563 | \property QRenderCapabilities::maxUBOSize | 
| 564 |  | 
| 565 | Returns the maximum size of UBOs, if supported. | 
| 566 |  | 
| 567 | \readonly | 
| 568 | */ | 
| 569 | int QRenderCapabilities::maxUBOSize() const | 
| 570 | { | 
| 571 |     Q_D(const QRenderCapabilities); | 
| 572 |     return d->m_maxUBOSize; | 
| 573 | } | 
| 574 |  | 
| 575 | /*! | 
| 576 | \qmlproperty int RenderCapabilities::maxUBOBindings | 
| 577 |  | 
| 578 | Returns the maximum number of available UBO binding points, if supported. | 
| 579 |  | 
| 580 | \readonly | 
| 581 | */ | 
| 582 | /*! | 
| 583 | \property QRenderCapabilities::maxUBOBindings | 
| 584 |  | 
| 585 | Returns the maximum number of available UBO binding points, if supported. | 
| 586 |  | 
| 587 | \readonly | 
| 588 | */ | 
| 589 | int QRenderCapabilities::maxUBOBindings() const | 
| 590 | { | 
| 591 |     Q_D(const QRenderCapabilities); | 
| 592 |     return d->m_maxUBOBindings; | 
| 593 | } | 
| 594 |  | 
| 595 | /*! | 
| 596 | \qmlproperty bool RenderCapabilities::supportsSSBO | 
| 597 |  | 
| 598 | Returns true if SSBOs are supported. | 
| 599 |  | 
| 600 | \readonly | 
| 601 | */ | 
| 602 | /*! | 
| 603 | \property QRenderCapabilities::supportsSSBO | 
| 604 |  | 
| 605 | Returns true if SSBOs are supported. | 
| 606 |  | 
| 607 | \readonly | 
| 608 | */ | 
| 609 | bool QRenderCapabilities::supportsSSBO() const | 
| 610 | { | 
| 611 |     Q_D(const QRenderCapabilities); | 
| 612 |     return d->m_supportsSSBO; | 
| 613 | } | 
| 614 |  | 
| 615 | /*! | 
| 616 | \qmlproperty int RenderCapabilities::maxSSBOSize | 
| 617 |  | 
| 618 | Returns the maximum size of SSBOs, if available. | 
| 619 |  | 
| 620 | \readonly | 
| 621 | */ | 
| 622 | /*! | 
| 623 | \property QRenderCapabilities::maxSSBOSize | 
| 624 |  | 
| 625 | Returns the maximum size of SSBOs, if available. | 
| 626 |  | 
| 627 | \readonly | 
| 628 | */ | 
| 629 | int QRenderCapabilities::maxSSBOSize() const | 
| 630 | { | 
| 631 |     Q_D(const QRenderCapabilities); | 
| 632 |     return d->m_maxSSBOSize; | 
| 633 | } | 
| 634 |  | 
| 635 | /*! | 
| 636 | \qmlproperty int RenderCapabilities::maxSSBOBindings | 
| 637 |  | 
| 638 | Returns the maximum number of available SSBO binding points, if supported. | 
| 639 |  | 
| 640 | \readonly | 
| 641 | */ | 
| 642 | /*! | 
| 643 | \property QRenderCapabilities::maxSSBOBindings | 
| 644 |  | 
| 645 | Returns the maximum number of available SSBO binding points, if supported. | 
| 646 |  | 
| 647 | \readonly | 
| 648 | */ | 
| 649 | int QRenderCapabilities::maxSSBOBindings() const | 
| 650 | { | 
| 651 |     Q_D(const QRenderCapabilities); | 
| 652 |     return d->m_maxSSBOBindings; | 
| 653 | } | 
| 654 |  | 
| 655 | /*! | 
| 656 | \qmlproperty bool RenderCapabilities::supportsImageStore | 
| 657 |  | 
| 658 | Returns true if Image Store operations are supported. | 
| 659 |  | 
| 660 | \readonly | 
| 661 | */ | 
| 662 | /*! | 
| 663 | \property QRenderCapabilities::supportsImageStore | 
| 664 |  | 
| 665 | Returns true if Image Store operations are supported. | 
| 666 |  | 
| 667 | \readonly | 
| 668 | */ | 
| 669 | bool QRenderCapabilities::supportsImageStore() const | 
| 670 | { | 
| 671 |     Q_D(const QRenderCapabilities); | 
| 672 |     return d->m_supportsImageStore; | 
| 673 | } | 
| 674 |  | 
| 675 | /*! | 
| 676 | \qmlproperty int RenderCapabilities::maxImageUnits | 
| 677 |  | 
| 678 | Returns the maximum number of available image units. | 
| 679 |  | 
| 680 | \readonly | 
| 681 | */ | 
| 682 | /*! | 
| 683 | \property QRenderCapabilities::maxImageUnits | 
| 684 |  | 
| 685 | Returns the maximum number of available image units. | 
| 686 |  | 
| 687 | \readonly | 
| 688 | */ | 
| 689 | int QRenderCapabilities::maxImageUnits() const | 
| 690 | { | 
| 691 |     Q_D(const QRenderCapabilities); | 
| 692 |     return d->m_maxImageUnits; | 
| 693 | } | 
| 694 |  | 
| 695 | /*! | 
| 696 | \qmlproperty bool RenderCapabilities::supportsCompute | 
| 697 |  | 
| 698 | Returns true if Compute Shaders are supported. | 
| 699 |  | 
| 700 | \readonly | 
| 701 | */ | 
| 702 | /*! | 
| 703 | \property QRenderCapabilities::supportsCompute | 
| 704 |  | 
| 705 | Returns true if Compute Shaders are supported. | 
| 706 |  | 
| 707 | \readonly | 
| 708 | */ | 
| 709 | bool QRenderCapabilities::supportsCompute() const | 
| 710 | { | 
| 711 |     Q_D(const QRenderCapabilities); | 
| 712 |     return d->m_supportCompute; | 
| 713 | } | 
| 714 |  | 
| 715 | /*! | 
| 716 | \qmlproperty int RenderCapabilities::maxWorkGroupCountX | 
| 717 |  | 
| 718 | Returns the maximum number of available Compute Shader workgroups in the X axis. | 
| 719 |  | 
| 720 | \readonly | 
| 721 | */ | 
| 722 | /*! | 
| 723 | \property QRenderCapabilities::maxWorkGroupCountX | 
| 724 |  | 
| 725 | Returns the maximum number of available Compute Shader workgroups in the X axis. | 
| 726 |  | 
| 727 | \readonly | 
| 728 | */ | 
| 729 | int QRenderCapabilities::maxWorkGroupCountX() const | 
| 730 | { | 
| 731 |     Q_D(const QRenderCapabilities); | 
| 732 |     return d->m_maxWorkGroupCount[0]; | 
| 733 | } | 
| 734 |  | 
| 735 | /*! | 
| 736 | \qmlproperty int RenderCapabilities::maxWorkGroupCountY | 
| 737 |  | 
| 738 | Returns the maximum number of available Compute Shader workgroups in the Y axis. | 
| 739 |  | 
| 740 | \readonly | 
| 741 | */ | 
| 742 | /*! | 
| 743 | \property QRenderCapabilities::maxWorkGroupCountY | 
| 744 |  | 
| 745 | Returns the maximum number of available Compute Shader workgroups in the Y axis. | 
| 746 |  | 
| 747 | \readonly | 
| 748 | */ | 
| 749 | int QRenderCapabilities::maxWorkGroupCountY() const | 
| 750 | { | 
| 751 |     Q_D(const QRenderCapabilities); | 
| 752 |     return d->m_maxWorkGroupCount[1]; | 
| 753 | } | 
| 754 |  | 
| 755 | /*! | 
| 756 | \qmlproperty int RenderCapabilities::maxWorkGroupCountZ | 
| 757 |  | 
| 758 | Returns the maximum number of available Compute Shader workgroups in the Z axis. | 
| 759 |  | 
| 760 | \readonly | 
| 761 | */ | 
| 762 | /*! | 
| 763 | \property QRenderCapabilities::maxWorkGroupCountZ | 
| 764 |  | 
| 765 | Returns the maximum number of available Compute Shader workgroups in the Z axis. | 
| 766 |  | 
| 767 | \readonly | 
| 768 | */ | 
| 769 | int QRenderCapabilities::maxWorkGroupCountZ() const | 
| 770 | { | 
| 771 |     Q_D(const QRenderCapabilities); | 
| 772 |     return d->m_maxWorkGroupCount[2]; | 
| 773 | } | 
| 774 |  | 
| 775 | /*! | 
| 776 | \qmlproperty int RenderCapabilities::maxWorkGroupSizeX | 
| 777 |  | 
| 778 | Returns the maximum size of Compute Shader local workgroups in the X axis. | 
| 779 |  | 
| 780 | \readonly | 
| 781 | */ | 
| 782 | /*! | 
| 783 | \property QRenderCapabilities::maxWorkGroupSizeX | 
| 784 |  | 
| 785 | Returns the maximum size of Compute Shader local workgroups in the X axis. | 
| 786 |  | 
| 787 | \readonly | 
| 788 | */ | 
| 789 | int QRenderCapabilities::maxWorkGroupSizeX() const | 
| 790 | { | 
| 791 |     Q_D(const QRenderCapabilities); | 
| 792 |     return d->m_maxWorkGroupSize[0]; | 
| 793 | } | 
| 794 |  | 
| 795 | /*! | 
| 796 | \qmlproperty int RenderCapabilities::maxWorkGroupSizeY | 
| 797 |  | 
| 798 | Returns the maximum size of Compute Shader local workgroups in the Y axis. | 
| 799 |  | 
| 800 | \readonly | 
| 801 | */ | 
| 802 | /*! | 
| 803 | \property QRenderCapabilities::maxWorkGroupSizeY | 
| 804 |  | 
| 805 | Returns the maximum size of Compute Shader local workgroups in the Y axis. | 
| 806 |  | 
| 807 | \readonly | 
| 808 | */ | 
| 809 | int QRenderCapabilities::maxWorkGroupSizeY() const | 
| 810 | { | 
| 811 |     Q_D(const QRenderCapabilities); | 
| 812 |     return d->m_maxWorkGroupSize[1]; | 
| 813 | } | 
| 814 |  | 
| 815 | /*! | 
| 816 | \qmlproperty int RenderCapabilities::maxWorkGroupSizeZ | 
| 817 |  | 
| 818 | Returns the maximum size of Compute Shader local workgroups in the Z axis. | 
| 819 |  | 
| 820 | \readonly | 
| 821 | */ | 
| 822 | /*! | 
| 823 | \property QRenderCapabilities::maxWorkGroupSizeZ | 
| 824 |  | 
| 825 | Returns the maximum size of Compute Shader local workgroups in the Z axis. | 
| 826 |  | 
| 827 | \readonly | 
| 828 | */ | 
| 829 | int QRenderCapabilities::maxWorkGroupSizeZ() const | 
| 830 | { | 
| 831 |     Q_D(const QRenderCapabilities); | 
| 832 |     return d->m_maxWorkGroupSize[2]; | 
| 833 | } | 
| 834 |  | 
| 835 | /*! | 
| 836 | \qmlproperty int RenderCapabilities::maxComputeInvocations | 
| 837 |  | 
| 838 | Returns the maximum number of Compute Shaders available. | 
| 839 |  | 
| 840 | \readonly | 
| 841 | */ | 
| 842 | /*! | 
| 843 | \property QRenderCapabilities::maxComputeInvocations | 
| 844 |  | 
| 845 | Returns the maximum number of Compute Shaders available. | 
| 846 |  | 
| 847 | \readonly | 
| 848 | */ | 
| 849 | int QRenderCapabilities::maxComputeInvocations() const | 
| 850 | { | 
| 851 |     Q_D(const QRenderCapabilities); | 
| 852 |     return d->m_maxComputeInvocations; | 
| 853 | } | 
| 854 |  | 
| 855 | /*! | 
| 856 | \qmlproperty int RenderCapabilities::maxComputeSharedMemorySize | 
| 857 |  | 
| 858 | Returns the maximum amount of shared memory available for Compute Shaders. | 
| 859 |  | 
| 860 | \readonly | 
| 861 | */ | 
| 862 | /*! | 
| 863 | \property QRenderCapabilities::maxComputeSharedMemorySize | 
| 864 |  | 
| 865 | Returns the maximum amount of shared memory available for Compute Shaders. | 
| 866 |  | 
| 867 | \readonly | 
| 868 | */ | 
| 869 | int QRenderCapabilities::maxComputeSharedMemorySize() const | 
| 870 | { | 
| 871 |     Q_D(const QRenderCapabilities); | 
| 872 |     return d->m_maxComputeSharedMemorySize; | 
| 873 | } | 
| 874 |  | 
| 875 | } // namespace Qt3Drender | 
| 876 |  | 
| 877 | QT_END_NAMESPACE | 
| 878 |  |