Changeset 846 for trunk/src/gui/egl/qegl.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/egl/qegl.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 45 45 #include <QtCore/qatomic.h> 46 46 #include <QtCore/qdebug.h> 47 47 48 #include "qegl_p.h" 49 #include "qeglcontext_p.h" 50 48 51 49 52 QT_BEGIN_NAMESPACE … … 62 65 static void deref() { 63 66 if (!contexts.deref()) { 64 eglTerminate(QEgl Context::display());67 eglTerminate(QEgl::display()); 65 68 displayOpen = 0; 66 69 } … … 84 87 static QEglContext * volatile currentVGContext = 0; 85 88 86 EGLDisplay QEglContext::dpy = EGL_NO_DISPLAY;87 88 89 QEglContext::QEglContext() 89 90 : apiType(QEgl::OpenGL) 90 91 , ctx(EGL_NO_CONTEXT) 91 , cfg( 0)92 , cfg(QEGL_NO_CONFIG) 92 93 , currentSurface(EGL_NO_SURFACE) 93 94 , current(false) … … 119 120 } 120 121 122 EGLConfig QEgl::defaultConfig(int devType, API api, ConfigOptions options) 123 { 124 if ( (devType != QInternal::Pixmap) && ((options & Renderable) == 0)) 125 qWarning("QEgl::defaultConfig() - Only configs for pixmaps make sense to be read-only!"); 126 127 EGLConfig* targetConfig = 0; 128 129 static EGLConfig defaultVGConfigs[] = { 130 QEGL_NO_CONFIG, // 0 Window Renderable Translucent 131 QEGL_NO_CONFIG, // 1 Window Renderable Opaque 132 QEGL_NO_CONFIG, // 2 Pixmap Renderable Translucent 133 QEGL_NO_CONFIG, // 3 Pixmap Renderable Opaque 134 QEGL_NO_CONFIG, // 4 Pixmap ReadOnly Translucent 135 QEGL_NO_CONFIG // 5 Pixmap ReadOnly Opaque 136 }; 137 if (api == OpenVG) { 138 if (devType == QInternal::Widget) { 139 if (options & Translucent) 140 targetConfig = &(defaultVGConfigs[0]); 141 else 142 targetConfig = &(defaultVGConfigs[1]); 143 } else if (devType == QInternal::Pixmap) { 144 if (options & Renderable) { 145 if (options & Translucent) 146 targetConfig = &(defaultVGConfigs[2]); 147 else // Opaque 148 targetConfig = &(defaultVGConfigs[3]); 149 } else { // Read-only 150 if (options & Translucent) 151 targetConfig = &(defaultVGConfigs[4]); 152 else // Opaque 153 targetConfig = &(defaultVGConfigs[5]); 154 } 155 } 156 } 157 158 159 static EGLConfig defaultGLConfigs[] = { 160 QEGL_NO_CONFIG, // 0 Window Renderable Translucent 161 QEGL_NO_CONFIG, // 1 Window Renderable Opaque 162 QEGL_NO_CONFIG, // 2 PBuffer Renderable Translucent 163 QEGL_NO_CONFIG, // 3 PBuffer Renderable Opaque 164 QEGL_NO_CONFIG, // 4 Pixmap Renderable Translucent 165 QEGL_NO_CONFIG, // 5 Pixmap Renderable Opaque 166 QEGL_NO_CONFIG, // 6 Pixmap ReadOnly Translucent 167 QEGL_NO_CONFIG // 7 Pixmap ReadOnly Opaque 168 }; 169 if (api == OpenGL) { 170 if (devType == QInternal::Widget) { 171 if (options & Translucent) 172 targetConfig = &(defaultGLConfigs[0]); 173 else // Opaque 174 targetConfig = &(defaultGLConfigs[1]); 175 } else if (devType == QInternal::Pbuffer) { 176 if (options & Translucent) 177 targetConfig = &(defaultGLConfigs[2]); 178 else // Opaque 179 targetConfig = &(defaultGLConfigs[3]); 180 } else if (devType == QInternal::Pixmap) { 181 if (options & Renderable) { 182 if (options & Translucent) 183 targetConfig = &(defaultGLConfigs[4]); 184 else // Opaque 185 targetConfig = &(defaultGLConfigs[5]); 186 } else { // ReadOnly 187 if (options & Translucent) 188 targetConfig = &(defaultGLConfigs[6]); 189 else // Opaque 190 targetConfig = &(defaultGLConfigs[7]); 191 } 192 } 193 } 194 195 if (!targetConfig) { 196 qWarning("QEgl::defaultConfig() - No default config for device/api/options combo"); 197 return QEGL_NO_CONFIG; 198 } 199 if (*targetConfig != QEGL_NO_CONFIG) 200 return *targetConfig; 201 202 203 // We haven't found an EGL config for the target config yet, so do it now: 204 205 206 // Allow overriding from an environment variable: 207 QByteArray configId; 208 if (api == OpenVG) 209 configId = qgetenv("QT_VG_EGL_CONFIG"); 210 else 211 configId = qgetenv("QT_GL_EGL_CONFIG"); 212 if (!configId.isEmpty()) { 213 // Overridden, so get the EGLConfig for the specified config ID: 214 EGLint properties[] = { 215 EGL_CONFIG_ID, (EGLint)configId.toInt(), 216 EGL_NONE 217 }; 218 EGLint configCount = 0; 219 eglChooseConfig(display(), properties, targetConfig, 1, &configCount); 220 if (configCount > 0) 221 return *targetConfig; 222 qWarning() << "QEgl::defaultConfig() -" << configId << "appears to be invalid"; 223 } 224 225 QEglProperties configAttribs; 226 configAttribs.setRenderableType(api); 227 228 EGLint surfaceType; 229 switch (devType) { 230 case QInternal::Widget: 231 surfaceType = EGL_WINDOW_BIT; 232 break; 233 case QInternal::Pixmap: 234 surfaceType = EGL_PIXMAP_BIT; 235 break; 236 case QInternal::Pbuffer: 237 surfaceType = EGL_PBUFFER_BIT; 238 break; 239 default: 240 qWarning("QEgl::defaultConfig() - Can't create EGL surface for %d device type", devType); 241 return QEGL_NO_CONFIG; 242 }; 243 #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT 244 // For OpenVG, we try to create a surface using a pre-multiplied format if 245 // the surface needs to have an alpha channel: 246 if (api == OpenVG && (options & Translucent)) 247 surfaceType |= EGL_VG_ALPHA_FORMAT_PRE_BIT; 248 #endif 249 configAttribs.setValue(EGL_SURFACE_TYPE, surfaceType); 250 251 #ifdef EGL_BIND_TO_TEXTURE_RGBA 252 if (devType == QInternal::Pixmap || devType == QInternal::Pbuffer) { 253 if (options & Translucent) 254 configAttribs.setValue(EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE); 255 else 256 configAttribs.setValue(EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE); 257 } 258 #endif 259 260 // Add paint engine requirements 261 if (api == OpenVG) { 262 #if !defined(QVG_SCISSOR_CLIP) && defined(EGL_ALPHA_MASK_SIZE) 263 configAttribs.setValue(EGL_ALPHA_MASK_SIZE, 1); 264 #endif 265 } else { 266 // Both OpenGL paint engines need to have stencil and sample buffers 267 configAttribs.setValue(EGL_STENCIL_SIZE, 1); 268 configAttribs.setValue(EGL_SAMPLE_BUFFERS, 1); 269 #ifndef QT_OPENGL_ES_2 270 // Additionally, the GL1 engine likes to have a depth buffer for clipping 271 configAttribs.setValue(EGL_DEPTH_SIZE, 1); 272 #endif 273 } 274 275 if (options & Translucent) 276 configAttribs.setValue(EGL_ALPHA_SIZE, 1); 277 278 *targetConfig = chooseConfig(&configAttribs, QEgl::BestPixelFormat); 279 return *targetConfig; 280 } 281 282 121 283 // Choose a configuration that matches "properties". 122 bool QEglContext::chooseConfig 123 (const QEglProperties& properties, QEgl::PixelFormatMatch match) 124 { 125 QEglProperties props(properties);284 EGLConfig QEgl::chooseConfig(const QEglProperties* properties, QEgl::PixelFormatMatch match) 285 { 286 QEglProperties props(*properties); 287 EGLConfig cfg = QEGL_NO_CONFIG; 126 288 do { 127 289 // Get the number of matching configurations for this set of properties. 128 290 EGLint matching = 0; 129 if (!eglChooseConfig(display(), props.properties(), 0, 0, &matching) || !matching) 291 EGLDisplay dpy = QEgl::display(); 292 if (!eglChooseConfig(dpy, props.properties(), 0, 0, &matching) || !matching) 130 293 continue; 131 294 … … 136 299 if (matching < 1) 137 300 continue; 138 return true;301 return cfg; 139 302 } 140 303 … … 157 320 cfg = configs[index]; 158 321 delete [] configs; 159 return true;322 return cfg; 160 323 } 161 324 } … … 174 337 qWarning() << "Requested:" << props.toString(); 175 338 qWarning() << "Available:"; 176 dumpAllConfigs(); 177 } 178 return false; 179 } 339 QEgl::dumpAllConfigs(); 340 } 341 return QEGL_NO_CONFIG; 342 } 343 344 bool QEglContext::chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match) 345 { 346 cfg = QEgl::chooseConfig(&properties, match); 347 return cfg != QEGL_NO_CONFIG; 348 } 349 350 EGLSurface QEglContext::createSurface(QPaintDevice* device, const QEglProperties *properties) 351 { 352 return QEgl::createSurface(device, cfg, properties); 353 } 354 180 355 181 356 // Create the EGLContext. … … 183 358 { 184 359 // We need to select the correct API before calling eglCreateContext(). 360 #ifdef QT_OPENGL_ES 185 361 #ifdef EGL_OPENGL_ES_API 186 362 if (apiType == QEgl::OpenGL) 187 363 eglBindAPI(EGL_OPENGL_ES_API); 188 364 #endif 365 #else 366 #ifdef EGL_OPENGL_API 367 if (apiType == QEgl::OpenGL) 368 eglBindAPI(EGL_OPENGL_API); 369 #endif 370 #endif //defined(QT_OPENGL_ES) 189 371 #ifdef EGL_OPENVG_API 190 372 if (apiType == QEgl::OpenVG) … … 196 378 if (properties) 197 379 contextProps = *properties; 198 #if defined(QT_OPENGL_ES_2)380 #ifdef QT_OPENGL_ES_2 199 381 if (apiType == QEgl::OpenGL) 200 382 contextProps.setValue(EGL_CONTEXT_CLIENT_VERSION, 2); … … 204 386 shareContext = 0; 205 387 if (shareContext) { 206 ctx = eglCreateContext( display(), cfg, shareContext->ctx, contextProps.properties());388 ctx = eglCreateContext(QEgl::display(), cfg, shareContext->ctx, contextProps.properties()); 207 389 if (ctx == EGL_NO_CONTEXT) { 208 qWarning() << "QEglContext::createContext(): Could not share context:" << errorString(eglGetError());390 qWarning() << "QEglContext::createContext(): Could not share context:" << QEgl::errorString(); 209 391 shareContext = 0; 210 392 } else { … … 215 397 ctx = eglCreateContext(display(), cfg, 0, contextProps.properties()); 216 398 if (ctx == EGL_NO_CONTEXT) { 217 qWarning() << "QEglContext::createContext(): Unable to create EGL context:" << errorString(eglGetError());399 qWarning() << "QEglContext::createContext(): Unable to create EGL context:" << QEgl::errorString(); 218 400 return false; 219 401 } … … 246 428 if (ctx == EGL_NO_CONTEXT) { 247 429 qWarning() << "QEglContext::makeCurrent(): Cannot make invalid context current"; 430 return false; 431 } 432 433 if (surface == EGL_NO_SURFACE) { 434 qWarning() << "QEglContext::makeCurrent(): Cannot make invalid surface current"; 248 435 return false; 249 436 } … … 272 459 #endif 273 460 274 bool ok = eglMakeCurrent( display(), surface, surface, ctx);461 bool ok = eglMakeCurrent(QEgl::display(), surface, surface, ctx); 275 462 if (!ok) 276 qWarning() << "QEglContext::makeCurrent( ):" << errorString(eglGetError());463 qWarning() << "QEglContext::makeCurrent(" << surface << "):" << QEgl::errorString(); 277 464 return ok; 278 465 } … … 301 488 #endif 302 489 303 bool ok = eglMakeCurrent( display(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);490 bool ok = eglMakeCurrent(QEgl::display(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); 304 491 if (!ok) 305 qWarning() << "QEglContext::doneCurrent():" << errorString(eglGetError());492 qWarning() << "QEglContext::doneCurrent():" << QEgl::errorString(); 306 493 return ok; 307 494 } … … 323 510 return false; 324 511 325 bool ok = eglSwapBuffers( display(), surface);512 bool ok = eglSwapBuffers(QEgl::display(), surface); 326 513 if (!ok) 327 qWarning() << "QEglContext::swapBuffers():" << errorString(eglGetError());514 qWarning() << "QEglContext::swapBuffers():" << QEgl::errorString(); 328 515 return ok; 329 516 } 330 517 331 // Wait for native rendering operations to complete before starting 332 // to use OpenGL/OpenVG operations. 333 void QEglContext::waitNative() 334 { 335 #ifdef EGL_CORE_NATIVE_ENGINE 336 eglWaitNative(EGL_CORE_NATIVE_ENGINE); 337 #endif 338 } 339 340 // Wait for client OpenGL/OpenVG operations to complete before 341 // using native rendering operations. 342 void QEglContext::waitClient() 343 { 344 #ifdef EGL_OPENGL_ES_API 345 if (apiType == QEgl::OpenGL) { 346 eglBindAPI(EGL_OPENGL_ES_API); 347 eglWaitClient(); 348 } 349 #else 350 if (apiType == QEgl::OpenGL) 351 eglWaitGL(); 352 #endif 353 #ifdef EGL_OPENVG_API 354 if (apiType == QEgl::OpenVG) { 355 eglBindAPI(EGL_OPENVG_API); 356 eglWaitClient(); 357 } 358 #endif 359 } 360 361 // Query the value of a configuration attribute. 362 bool QEglContext::configAttrib(int name, EGLint *value) const 363 { 364 return eglGetConfigAttrib(display(), cfg, name, value); 365 } 366 367 void QEglContext::clearError() 368 { 369 eglGetError(); 370 } 371 372 EGLint QEglContext::error() 373 { 374 return eglGetError(); 375 } 376 377 // Retrieve all of the properties on "cfg". If zero, return 378 // the context's configuration. 379 QEglProperties QEglContext::configProperties(EGLConfig cfg) const 380 { 381 if (!cfg) 382 cfg = config(); 383 QEglProperties props; 384 for (int name = 0x3020; name <= 0x304F; ++name) { 385 EGLint value; 386 if (name != EGL_NONE && eglGetConfigAttrib(display(), cfg, name, &value)) 387 props.setValue(name, value); 388 } 389 eglGetError(); // Clear the error state. 390 return props; 391 } 392 393 EGLDisplay QEglContext::display() 394 { 518 bool QEglContext::swapBuffersRegion2NOK(EGLSurface surface, const QRegion *region) { 519 QVector<QRect> qrects = region->rects(); 520 EGLint *gl_rects; 521 uint count; 522 uint i; 523 524 count = qrects.size(); 525 QVarLengthArray <EGLint> arr(4 * count); 526 gl_rects = arr.data(); 527 for (i = 0; i < count; i++) { 528 QRect qrect = qrects[i]; 529 530 gl_rects[4 * i + 0] = qrect.x(); 531 gl_rects[4 * i + 1] = qrect.y(); 532 gl_rects[4 * i + 2] = qrect.width(); 533 gl_rects[4 * i + 3] = qrect.height(); 534 } 535 536 bool ok = QEgl::eglSwapBuffersRegion2NOK(QEgl::display(), surface, count, gl_rects); 537 538 if (!ok) 539 qWarning() << "QEglContext::swapBuffersRegion2NOK():" << QEgl::errorString(); 540 return ok; 541 } 542 543 int QEglContext::configAttrib(int name) const 544 { 545 EGLint value; 546 EGLBoolean success = eglGetConfigAttrib(QEgl::display(), cfg, name, &value); 547 if (success) 548 return value; 549 else 550 return EGL_DONT_CARE; 551 } 552 553 typedef EGLImageKHR (EGLAPIENTRY *_eglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint*); 554 typedef EGLBoolean (EGLAPIENTRY *_eglDestroyImageKHR)(EGLDisplay, EGLImageKHR); 555 556 // Defined in qegl.cpp: 557 static _eglCreateImageKHR qt_eglCreateImageKHR = 0; 558 static _eglDestroyImageKHR qt_eglDestroyImageKHR = 0; 559 560 typedef EGLBoolean (EGLAPIENTRY *_eglSwapBuffersRegion2NOK)(EGLDisplay, EGLSurface, EGLint, const EGLint*); 561 562 static _eglSwapBuffersRegion2NOK qt_eglSwapBuffersRegion2NOK = 0; 563 564 EGLDisplay QEgl::display() 565 { 566 static EGLDisplay dpy = EGL_NO_DISPLAY; 395 567 if (!QEglContextTracker::displayOpened()) { 396 568 dpy = eglGetDisplay(nativeDisplay()); 397 569 QEglContextTracker::setDisplayOpened(); 398 570 if (dpy == EGL_NO_DISPLAY) { 399 qWarning("QEgl Context::display(): Falling back to EGL_DEFAULT_DISPLAY");571 qWarning("QEgl::display(): Falling back to EGL_DEFAULT_DISPLAY"); 400 572 dpy = eglGetDisplay(EGLNativeDisplayType(EGL_DEFAULT_DISPLAY)); 401 573 } 402 574 if (dpy == EGL_NO_DISPLAY) { 403 qWarning("QEgl Context::display(): Can't even open the default display");575 qWarning("QEgl::display(): Can't even open the default display"); 404 576 return EGL_NO_DISPLAY; 405 577 } 406 578 407 579 if (!eglInitialize(dpy, NULL, NULL)) { 408 qWarning() << "QEgl Context::display(): Cannot initialize EGL display:" << errorString(eglGetError());580 qWarning() << "QEgl::display(): Cannot initialize EGL display:" << QEgl::errorString(); 409 581 return EGL_NO_DISPLAY; 410 582 } 583 584 // Resolve the egl extension function pointers: 585 #if (defined(EGL_KHR_image) || defined(EGL_KHR_image_base)) && !defined(EGL_EGLEXT_PROTOTYPES) 586 if (QEgl::hasExtension("EGL_KHR_image") || QEgl::hasExtension("EGL_KHR_image_base")) { 587 qt_eglCreateImageKHR = (_eglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR"); 588 qt_eglDestroyImageKHR = (_eglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR"); 589 } 590 #endif 591 592 if (QEgl::hasExtension("EGL_NOK_swap_region2")) { 593 qt_eglSwapBuffersRegion2NOK = (_eglSwapBuffersRegion2NOK) eglGetProcAddress("eglSwapBuffersRegion2NOK"); 594 } 411 595 } 412 596 … … 414 598 } 415 599 416 #if !defined(Q_WS_X11) && !defined(Q_WS_WINCE) // WinCE & X11 implement this properly 417 EGLNativeDisplayType QEglContext::nativeDisplay() 418 { 419 return EGL_DEFAULT_DISPLAY; 420 } 421 #endif 600 EGLImageKHR QEgl::eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list) 601 { 602 if (qt_eglCreateImageKHR) 603 return qt_eglCreateImageKHR(dpy, ctx, target, buffer, attrib_list); 604 605 QEgl::display(); // Initialises function pointers 606 if (qt_eglCreateImageKHR) 607 return qt_eglCreateImageKHR(dpy, ctx, target, buffer, attrib_list); 608 609 qWarning("QEgl::eglCreateImageKHR() called but EGL_KHR_image(_base) extension not present"); 610 return 0; 611 } 612 613 EGLBoolean QEgl::eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img) 614 { 615 if (qt_eglDestroyImageKHR) 616 return qt_eglDestroyImageKHR(dpy, img); 617 618 QEgl::display(); // Initialises function pointers 619 if (qt_eglDestroyImageKHR) 620 return qt_eglDestroyImageKHR(dpy, img); 621 622 qWarning("QEgl::eglDestroyImageKHR() called but EGL_KHR_image(_base) extension not present"); 623 return 0; 624 } 625 626 EGLBoolean QEgl::eglSwapBuffersRegion2NOK(EGLDisplay dpy, EGLSurface surface, EGLint count, const EGLint *rects) 627 { 628 if (qt_eglSwapBuffersRegion2NOK) 629 return qt_eglSwapBuffersRegion2NOK(dpy, surface, count, rects); 630 631 QEgl::display(); // Initialises function pointers 632 if (qt_eglSwapBuffersRegion2NOK) 633 return qt_eglSwapBuffersRegion2NOK(dpy, surface, count, rects); 634 635 qWarning("QEgl::eglSwapBuffersRegion2NOK() called but EGL_NOK_swap_region2 extension not present"); 636 return 0; 637 } 638 639 #ifndef Q_WS_X11 640 EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) 641 { 642 // Create the native drawable for the paint device. 643 int devType = device->devType(); 644 EGLNativePixmapType pixmapDrawable = 0; 645 EGLNativeWindowType windowDrawable = 0; 646 bool ok; 647 if (devType == QInternal::Pixmap) { 648 pixmapDrawable = nativePixmap(static_cast<QPixmap *>(device)); 649 ok = (pixmapDrawable != 0); 650 } else if (devType == QInternal::Widget) { 651 windowDrawable = nativeWindow(static_cast<QWidget *>(device)); 652 ok = (windowDrawable != 0); 653 } else { 654 ok = false; 655 } 656 if (!ok) { 657 qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable"); 658 return EGL_NO_SURFACE; 659 } 660 661 // Create the EGL surface to draw into, based on the native drawable. 662 const int *props; 663 if (properties) 664 props = properties->properties(); 665 else 666 props = 0; 667 EGLSurface surf; 668 if (devType == QInternal::Widget) 669 surf = eglCreateWindowSurface(QEgl::display(), cfg, windowDrawable, props); 670 else 671 surf = eglCreatePixmapSurface(QEgl::display(), cfg, pixmapDrawable, props); 672 if (surf == EGL_NO_SURFACE) { 673 qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError()); 674 } 675 return surf; 676 } 677 #endif 678 422 679 423 680 // Return the error string associated with a specific code. 424 QString QEgl Context::errorString(EGLint code)681 QString QEgl::errorString(EGLint code) 425 682 { 426 683 static const char * const errors[] = { … … 449 706 450 707 // Dump all of the EGL configurations supported by the system. 451 void QEgl Context::dumpAllConfigs()708 void QEgl::dumpAllConfigs() 452 709 { 453 710 QEglProperties props; … … 458 715 eglGetConfigs(display(), configs, count, &count); 459 716 for (EGLint index = 0; index < count; ++index) { 460 props = configProperties(configs[index]);717 props = QEglProperties(configs[index]); 461 718 qWarning() << props.toString(); 462 719 } … … 464 721 } 465 722 466 QString QEgl Context::extensions()467 { 468 const char* exts = eglQueryString(QEgl Context::display(), EGL_EXTENSIONS);723 QString QEgl::extensions() 724 { 725 const char* exts = eglQueryString(QEgl::display(), EGL_EXTENSIONS); 469 726 return QString(QLatin1String(exts)); 470 727 } 471 728 472 bool QEgl Context::hasExtension(const char* extensionName)729 bool QEgl::hasExtension(const char* extensionName) 473 730 { 474 731 QList<QByteArray> extensions = 475 732 QByteArray(reinterpret_cast<const char *> 476 (eglQueryString(QEgl Context::display(), EGL_EXTENSIONS))).split(' ');733 (eglQueryString(QEgl::display(), EGL_EXTENSIONS))).split(' '); 477 734 return extensions.contains(extensionName); 478 735 }
Note:
See TracChangeset
for help on using the changeset viewer.