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