| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/platformsupport/eglconvenience/qeglplatformcontext.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, | - | ||||||||||||
| 8 | EGLConfig *config, const QVariant &nativeHandle, Flags flags) | - | ||||||||||||
| 9 | : m_eglDisplay(display) | - | ||||||||||||
| 10 | , m_swapInterval(-1) | - | ||||||||||||
| 11 | , m_swapIntervalEnvChecked(false) | - | ||||||||||||
| 12 | , m_swapIntervalFromEnv(-1) | - | ||||||||||||
| 13 | , m_flags(flags) | - | ||||||||||||
| 14 | { | - | ||||||||||||
| 15 | if (nativeHandle.isNull() 
 | 0 | ||||||||||||
| 16 | m_eglConfig = config 
 | 0 | ||||||||||||
| 17 | m_ownsContext = true; | - | ||||||||||||
| 18 | init(format, share); | - | ||||||||||||
| 19 | } never executed: else { end of block | 0 | ||||||||||||
| 20 | m_ownsContext = false; | - | ||||||||||||
| 21 | adopt(nativeHandle, share); | - | ||||||||||||
| 22 | } never executed:  end of block | 0 | ||||||||||||
| 23 | } | - | ||||||||||||
| 24 | - | |||||||||||||
| 25 | void QEGLPlatformContext::init(const QSurfaceFormat &format, QPlatformOpenGLContext *share) | - | ||||||||||||
| 26 | { | - | ||||||||||||
| 27 | m_format = q_glFormatFromConfig(m_eglDisplay, m_eglConfig); | - | ||||||||||||
| 28 | - | |||||||||||||
| 29 | - | |||||||||||||
| 30 | m_shareContext = share 
 | 0 | ||||||||||||
| 31 | - | |||||||||||||
| 32 | QVector<EGLint> contextAttrs; | - | ||||||||||||
| 33 | contextAttrs.append(0x3098); | - | ||||||||||||
| 34 | contextAttrs.append(format.majorVersion()); | - | ||||||||||||
| 35 | const bool hasKHRCreateContext = q_hasEglExtension(m_eglDisplay, "EGL_KHR_create_context"); | - | ||||||||||||
| 36 | if (hasKHRCreateContext 
 | 0 | ||||||||||||
| 37 | contextAttrs.append(0x30FB); | - | ||||||||||||
| 38 | contextAttrs.append(format.minorVersion()); | - | ||||||||||||
| 39 | int flags = 0; | - | ||||||||||||
| 40 | - | |||||||||||||
| 41 | if (format.testOption(QSurfaceFormat::DebugContext) 
 | 0 | ||||||||||||
| 42 | flags |= 0x00000001; never executed:  flags |= 0x00000001; | 0 | ||||||||||||
| 43 | - | |||||||||||||
| 44 | if (m_format.renderableType() == QSurfaceFormat::OpenGL 
 | 0 | ||||||||||||
| 45 | && format.majorVersion() >= 3 
 | 0 | ||||||||||||
| 46 | && !format.testOption(QSurfaceFormat::DeprecatedFunctions) 
 | 0 | ||||||||||||
| 47 | flags |= 0x00000002; never executed:  flags |= 0x00000002; | 0 | ||||||||||||
| 48 | if (flags 
 | 0 | ||||||||||||
| 49 | contextAttrs.append(0x30FC); | - | ||||||||||||
| 50 | contextAttrs.append(flags); | - | ||||||||||||
| 51 | } never executed:  end of block | 0 | ||||||||||||
| 52 | - | |||||||||||||
| 53 | if (m_format.renderableType() == QSurfaceFormat::OpenGL 
 | 0 | ||||||||||||
| 54 | contextAttrs.append(0x30FD); | - | ||||||||||||
| 55 | contextAttrs.append(format.profile() == QSurfaceFormat::CoreProfile | - | ||||||||||||
| 56 | ? 0x00000001 | - | ||||||||||||
| 57 | : 0x00000002); | - | ||||||||||||
| 58 | } never executed:  end of block | 0 | ||||||||||||
| 59 | } never executed:  end of block | 0 | ||||||||||||
| 60 | contextAttrs.append(0x3038); | - | ||||||||||||
| 61 | m_contextAttrs = contextAttrs; | - | ||||||||||||
| 62 | - | |||||||||||||
| 63 | switch (m_format.renderableType()) { | - | ||||||||||||
| 64 | case never executed: QSurfaceFormat::OpenVG: case QSurfaceFormat::OpenVG:never executed:  case QSurfaceFormat::OpenVG: | 0 | ||||||||||||
| 65 | m_api = 0x30A1; | - | ||||||||||||
| 66 | break; never executed:  break; | 0 | ||||||||||||
| 67 | - | |||||||||||||
| 68 | case never executed: QSurfaceFormat::OpenGL: case QSurfaceFormat::OpenGL:never executed:  case QSurfaceFormat::OpenGL: | 0 | ||||||||||||
| 69 | m_api = 0x30A2; | - | ||||||||||||
| 70 | break; never executed:  break; | 0 | ||||||||||||
| 71 | - | |||||||||||||
| 72 | default never executed: : default:never executed:  default: | 0 | ||||||||||||
| 73 | m_api = 0x30A0; | - | ||||||||||||
| 74 | break; never executed:  break; | 0 | ||||||||||||
| 75 | } | - | ||||||||||||
| 76 | - | |||||||||||||
| 77 | eglBindAPI(m_api); | - | ||||||||||||
| 78 | m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, m_shareContext, contextAttrs.constData()); | - | ||||||||||||
| 79 | if (m_eglContext == ((EGLContext)0) 
 
 | 0 | ||||||||||||
| 80 | m_shareContext = 0; | - | ||||||||||||
| 81 | m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, 0, contextAttrs.constData()); | - | ||||||||||||
| 82 | } never executed:  end of block | 0 | ||||||||||||
| 83 | - | |||||||||||||
| 84 | if (m_eglContext == ((EGLContext)0) 
 | 0 | ||||||||||||
| 85 | QMessageLogger(__FILE__, 186, __PRETTY_FUNCTION__).warning("QEGLPlatformContext: Failed to create context: %x", eglGetError()); | - | ||||||||||||
| 86 | return; never executed:  return; | 0 | ||||||||||||
| 87 | } | - | ||||||||||||
| 88 | - | |||||||||||||
| 89 | static const bool printConfig = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DEBUG"); | - | ||||||||||||
| 90 | if (printConfig 
 | 0 | ||||||||||||
| 91 | QMessageLogger(__FILE__, 192, __PRETTY_FUNCTION__).debug() << "Created context for format" << format << "with config:"; | - | ||||||||||||
| 92 | q_printEglConfig(m_eglDisplay, m_eglConfig); | - | ||||||||||||
| 93 | } never executed:  end of block | 0 | ||||||||||||
| 94 | - | |||||||||||||
| 95 | - | |||||||||||||
| 96 | } never executed:  end of block | 0 | ||||||||||||
| 97 | - | |||||||||||||
| 98 | void QEGLPlatformContext::adopt(const QVariant &nativeHandle, QPlatformOpenGLContext *share) | - | ||||||||||||
| 99 | { | - | ||||||||||||
| 100 | if (!nativeHandle.canConvert<QEGLNativeContext>() 
 | 0 | ||||||||||||
| 101 | QMessageLogger(__FILE__, 202, __PRETTY_FUNCTION__).warning("QEGLPlatformContext: Requires a QEGLNativeContext"); | - | ||||||||||||
| 102 | return; never executed:  return; | 0 | ||||||||||||
| 103 | } | - | ||||||||||||
| 104 | QEGLNativeContext handle = nativeHandle.value<QEGLNativeContext>(); | - | ||||||||||||
| 105 | EGLContext context = handle.context(); | - | ||||||||||||
| 106 | if (!context 
 | 0 | ||||||||||||
| 107 | QMessageLogger(__FILE__, 208, __PRETTY_FUNCTION__).warning("QEGLPlatformContext: No EGLContext given"); | - | ||||||||||||
| 108 | return; never executed:  return; | 0 | ||||||||||||
| 109 | } | - | ||||||||||||
| 110 | - | |||||||||||||
| 111 | - | |||||||||||||
| 112 | if (handle.display() != m_eglDisplay 
 | 0 | ||||||||||||
| 113 | QMessageLogger(__FILE__, 214, __PRETTY_FUNCTION__).warning("QEGLPlatformContext: Cannot adopt context from different display"); | - | ||||||||||||
| 114 | return; never executed:  return; | 0 | ||||||||||||
| 115 | } | - | ||||||||||||
| 116 | - | |||||||||||||
| 117 | - | |||||||||||||
| 118 | EGLint value = 0; | - | ||||||||||||
| 119 | eglQueryContext(m_eglDisplay, context, 0x3028, &value); | - | ||||||||||||
| 120 | EGLint n = 0; | - | ||||||||||||
| 121 | EGLConfig cfg; | - | ||||||||||||
| 122 | const EGLint attribs[] = { 0x3028, value, 0x3038 }; | - | ||||||||||||
| 123 | if (eglChooseConfig(m_eglDisplay, attribs, &cfg, 1, &n) 
 
 | 0 | ||||||||||||
| 124 | m_eglConfig = cfg; | - | ||||||||||||
| 125 | m_format = q_glFormatFromConfig(m_eglDisplay, m_eglConfig); | - | ||||||||||||
| 126 | } never executed: else { end of block | 0 | ||||||||||||
| 127 | QMessageLogger(__FILE__, 228, __PRETTY_FUNCTION__).warning("QEGLPlatformContext: Failed to get framebuffer configuration for context"); | - | ||||||||||||
| 128 | } never executed:  end of block | 0 | ||||||||||||
| 129 | - | |||||||||||||
| 130 | - | |||||||||||||
| 131 | value = 0; | - | ||||||||||||
| 132 | eglQueryContext(m_eglDisplay, context, 0x3097, &value); | - | ||||||||||||
| 133 | if (value == 0x30A2 
 
 | 0 | ||||||||||||
| 134 | m_api = value; | - | ||||||||||||
| 135 | eglBindAPI(m_api); | - | ||||||||||||
| 136 | } never executed: else { end of block | 0 | ||||||||||||
| 137 | QMessageLogger(__FILE__, 238, __PRETTY_FUNCTION__).warning("QEGLPlatformContext: Failed to get client API type"); | - | ||||||||||||
| 138 | m_api = 0x30A0; | - | ||||||||||||
| 139 | } never executed:  end of block | 0 | ||||||||||||
| 140 | - | |||||||||||||
| 141 | m_eglContext = context; | - | ||||||||||||
| 142 | m_shareContext = share 
 | 0 | ||||||||||||
| 143 | updateFormatFromGL(); | - | ||||||||||||
| 144 | } never executed:  end of block | 0 | ||||||||||||
| 145 | - | |||||||||||||
| 146 | void QEGLPlatformContext::initialize() | - | ||||||||||||
| 147 | { | - | ||||||||||||
| 148 | if (m_eglContext != ((EGLContext)0) 
 | 0 | ||||||||||||
| 149 | updateFormatFromGL(); never executed:  updateFormatFromGL(); | 0 | ||||||||||||
| 150 | } never executed:  end of block | 0 | ||||||||||||
| 151 | - | |||||||||||||
| 152 | - | |||||||||||||
| 153 | - | |||||||||||||
| 154 | EGLSurface QEGLPlatformContext::createTemporaryOffscreenSurface() | - | ||||||||||||
| 155 | { | - | ||||||||||||
| 156 | - | |||||||||||||
| 157 | const EGLint pbufferAttributes[] = { | - | ||||||||||||
| 158 | 0x3057, 1, | - | ||||||||||||
| 159 | 0x3056, 1, | - | ||||||||||||
| 160 | 0x3058, 0, | - | ||||||||||||
| 161 | 0x3038 | - | ||||||||||||
| 162 | }; | - | ||||||||||||
| 163 | - | |||||||||||||
| 164 | - | |||||||||||||
| 165 | - | |||||||||||||
| 166 | - | |||||||||||||
| 167 | EGLConfig config = q_configFromGLFormat(m_eglDisplay, m_format, false, 0x0001); | - | ||||||||||||
| 168 | - | |||||||||||||
| 169 | return never executed: eglCreatePbufferSurface(m_eglDisplay, config, pbufferAttributes); return eglCreatePbufferSurface(m_eglDisplay, config, pbufferAttributes);never executed:  return eglCreatePbufferSurface(m_eglDisplay, config, pbufferAttributes); | 0 | ||||||||||||
| 170 | } | - | ||||||||||||
| 171 | - | |||||||||||||
| 172 | void QEGLPlatformContext::destroyTemporaryOffscreenSurface(EGLSurface surface) | - | ||||||||||||
| 173 | { | - | ||||||||||||
| 174 | eglDestroySurface(m_eglDisplay, surface); | - | ||||||||||||
| 175 | } never executed:  end of block | 0 | ||||||||||||
| 176 | - | |||||||||||||
| 177 | void QEGLPlatformContext::runGLChecks() | - | ||||||||||||
| 178 | { | - | ||||||||||||
| 179 | - | |||||||||||||
| 180 | - | |||||||||||||
| 181 | } | - | ||||||||||||
| 182 | - | |||||||||||||
| 183 | void QEGLPlatformContext::updateFormatFromGL() | - | ||||||||||||
| 184 | { | - | ||||||||||||
| 185 | - | |||||||||||||
| 186 | - | |||||||||||||
| 187 | - | |||||||||||||
| 188 | EGLDisplay prevDisplay = eglGetCurrentDisplay(); | - | ||||||||||||
| 189 | if (prevDisplay == ((EGLDisplay)0) 
 | 0 | ||||||||||||
| 190 | prevDisplay = m_eglDisplay; never executed:  prevDisplay = m_eglDisplay; | 0 | ||||||||||||
| 191 | EGLContext prevContext = eglGetCurrentContext(); | - | ||||||||||||
| 192 | EGLSurface prevSurfaceDraw = eglGetCurrentSurface(0x3059); | - | ||||||||||||
| 193 | EGLSurface prevSurfaceRead = eglGetCurrentSurface(0x305A); | - | ||||||||||||
| 194 | - | |||||||||||||
| 195 | - | |||||||||||||
| 196 | - | |||||||||||||
| 197 | - | |||||||||||||
| 198 | EGLSurface tempSurface = ((EGLSurface)0); | - | ||||||||||||
| 199 | EGLContext tempContext = ((EGLContext)0); | - | ||||||||||||
| 200 | if (m_flags.testFlag(NoSurfaceless) 
 
 | 0 | ||||||||||||
| 201 | tempSurface = createTemporaryOffscreenSurface(); never executed:  tempSurface = createTemporaryOffscreenSurface(); | 0 | ||||||||||||
| 202 | - | |||||||||||||
| 203 | EGLBoolean ok = eglMakeCurrent(m_eglDisplay, tempSurface, tempSurface, m_eglContext); | - | ||||||||||||
| 204 | if (!ok 
 | 0 | ||||||||||||
| 205 | EGLConfig config = q_configFromGLFormat(m_eglDisplay, m_format, false, 0x0001); | - | ||||||||||||
| 206 | tempContext = eglCreateContext(m_eglDisplay, config, 0, m_contextAttrs.constData()); | - | ||||||||||||
| 207 | if (tempContext != ((EGLContext)0) 
 | 0 | ||||||||||||
| 208 | ok = eglMakeCurrent(m_eglDisplay, tempSurface, tempSurface, tempContext); never executed:  ok = eglMakeCurrent(m_eglDisplay, tempSurface, tempSurface, tempContext); | 0 | ||||||||||||
| 209 | } never executed:  end of block | 0 | ||||||||||||
| 210 | if (ok 
 | 0 | ||||||||||||
| 211 | if (m_format.renderableType() == QSurfaceFormat::OpenGL 
 | 0 | ||||||||||||
| 212 | || m_format.renderableType() == QSurfaceFormat::OpenGLES 
 | 0 | ||||||||||||
| 213 | const GLubyte *s = glGetString(0x1F02); | - | ||||||||||||
| 214 | if (s 
 | 0 | ||||||||||||
| 215 | QByteArray version = QByteArray(reinterpret_cast<const char *>(s)); | - | ||||||||||||
| 216 | int major, minor; | - | ||||||||||||
| 217 | if (QPlatformOpenGLContext::parseOpenGLVersion(version, major, minor) 
 | 0 | ||||||||||||
| 218 | m_format.setMajorVersion(major); | - | ||||||||||||
| 219 | m_format.setMinorVersion(minor); | - | ||||||||||||
| 220 | } never executed:  end of block | 0 | ||||||||||||
| 221 | } never executed:  end of block | 0 | ||||||||||||
| 222 | m_format.setProfile(QSurfaceFormat::NoProfile); | - | ||||||||||||
| 223 | m_format.setOptions(QSurfaceFormat::FormatOptions()); | - | ||||||||||||
| 224 | if (m_format.renderableType() == QSurfaceFormat::OpenGL 
 | 0 | ||||||||||||
| 225 | - | |||||||||||||
| 226 | if (m_format.majorVersion() < 3 
 | 0 | ||||||||||||
| 227 | m_format.setOption(QSurfaceFormat::DeprecatedFunctions); | - | ||||||||||||
| 228 | } never executed: else { end of block | 0 | ||||||||||||
| 229 | GLint value = 0; | - | ||||||||||||
| 230 | glGetIntegerv(0x821E, &value); | - | ||||||||||||
| 231 | if (!(value & 0x00000001) 
 | 0 | ||||||||||||
| 232 | m_format.setOption(QSurfaceFormat::DeprecatedFunctions); never executed:  m_format.setOption(QSurfaceFormat::DeprecatedFunctions); | 0 | ||||||||||||
| 233 | if (value & 0x00000002 
 | 0 | ||||||||||||
| 234 | m_format.setOption(QSurfaceFormat::DebugContext); never executed:  m_format.setOption(QSurfaceFormat::DebugContext); | 0 | ||||||||||||
| 235 | if (m_format.version() >= qMakePair(3, 2) 
 | 0 | ||||||||||||
| 236 | value = 0; | - | ||||||||||||
| 237 | glGetIntegerv(0x9126, &value); | - | ||||||||||||
| 238 | if (value & 0x00000001 
 | 0 | ||||||||||||
| 239 | m_format.setProfile(QSurfaceFormat::CoreProfile); never executed:  m_format.setProfile(QSurfaceFormat::CoreProfile); | 0 | ||||||||||||
| 240 | else if (value & 0x00000002 
 | 0 | ||||||||||||
| 241 | m_format.setProfile(QSurfaceFormat::CompatibilityProfile); never executed:  m_format.setProfile(QSurfaceFormat::CompatibilityProfile); | 0 | ||||||||||||
| 242 | } never executed:  end of block | 0 | ||||||||||||
| 243 | } never executed:  end of block | 0 | ||||||||||||
| 244 | } | - | ||||||||||||
| 245 | } never executed:  end of block | 0 | ||||||||||||
| 246 | runGLChecks(); | - | ||||||||||||
| 247 | eglMakeCurrent(prevDisplay, prevSurfaceDraw, prevSurfaceRead, prevContext); | - | ||||||||||||
| 248 | } never executed: else { end of block | 0 | ||||||||||||
| 249 | QMessageLogger(__FILE__, 358, __PRETTY_FUNCTION__).warning("QEGLPlatformContext: Failed to make temporary surface current, format not updated (%x)", eglGetError()); | - | ||||||||||||
| 250 | } never executed:  end of block | 0 | ||||||||||||
| 251 | if (tempSurface != ((EGLSurface)0) 
 | 0 | ||||||||||||
| 252 | destroyTemporaryOffscreenSurface(tempSurface); never executed:  destroyTemporaryOffscreenSurface(tempSurface); | 0 | ||||||||||||
| 253 | if (tempContext != ((EGLContext)0) 
 | 0 | ||||||||||||
| 254 | eglDestroyContext(m_eglDisplay, tempContext); never executed:  eglDestroyContext(m_eglDisplay, tempContext); | 0 | ||||||||||||
| 255 | - | |||||||||||||
| 256 | } never executed:  end of block | 0 | ||||||||||||
| 257 | - | |||||||||||||
| 258 | bool QEGLPlatformContext::makeCurrent(QPlatformSurface *surface) | - | ||||||||||||
| 259 | { | - | ||||||||||||
| 260 | ((!(surface->surface()->supportsOpenGL())) ? qt_assert("surface->surface()->supportsOpenGL()",__FILE__,369) : qt_noop()); | - | ||||||||||||
| 261 | - | |||||||||||||
| 262 | eglBindAPI(m_api); | - | ||||||||||||
| 263 | - | |||||||||||||
| 264 | EGLSurface eglSurface = eglSurfaceForPlatformSurface(surface); | - | ||||||||||||
| 265 | - | |||||||||||||
| 266 | - | |||||||||||||
| 267 | if (eglGetCurrentContext() == m_eglContext 
 | 0 | ||||||||||||
| 268 | eglGetCurrentDisplay() == m_eglDisplay 
 | 0 | ||||||||||||
| 269 | eglGetCurrentSurface(0x305A) == eglSurface 
 | 0 | ||||||||||||
| 270 | eglGetCurrentSurface(0x3059) == eglSurface 
 | 0 | ||||||||||||
| 271 | return never executed: true; return true;never executed:  return true; | 0 | ||||||||||||
| 272 | } | - | ||||||||||||
| 273 | - | |||||||||||||
| 274 | const bool ok = eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_eglContext); | - | ||||||||||||
| 275 | if (ok 
 | 0 | ||||||||||||
| 276 | if (!m_swapIntervalEnvChecked 
 | 0 | ||||||||||||
| 277 | m_swapIntervalEnvChecked = true; | - | ||||||||||||
| 278 | if (qEnvironmentVariableIsSet("QT_QPA_EGLFS_SWAPINTERVAL") 
 | 0 | ||||||||||||
| 279 | QByteArray swapIntervalString = qgetenv("QT_QPA_EGLFS_SWAPINTERVAL"); | - | ||||||||||||
| 280 | bool intervalOk; | - | ||||||||||||
| 281 | const int swapInterval = swapIntervalString.toInt(&intervalOk); | - | ||||||||||||
| 282 | if (intervalOk 
 | 0 | ||||||||||||
| 283 | m_swapIntervalFromEnv = swapInterval; never executed:  m_swapIntervalFromEnv = swapInterval; | 0 | ||||||||||||
| 284 | } never executed:  end of block | 0 | ||||||||||||
| 285 | } never executed:  end of block | 0 | ||||||||||||
| 286 | const int requestedSwapInterval = m_swapIntervalFromEnv >= 0 
 | 0 | ||||||||||||
| 287 | ? m_swapIntervalFromEnv | - | ||||||||||||
| 288 | : surface->format().swapInterval(); | - | ||||||||||||
| 289 | if (requestedSwapInterval >= 0 
 
 | 0 | ||||||||||||
| 290 | m_swapInterval = requestedSwapInterval; | - | ||||||||||||
| 291 | if (eglSurface != ((EGLSurface)0) 
 | 0 | ||||||||||||
| 292 | eglSwapInterval(eglDisplay(), m_swapInterval); never executed:  eglSwapInterval(eglDisplay(), m_swapInterval); | 0 | ||||||||||||
| 293 | } never executed:  end of block | 0 | ||||||||||||
| 294 | } never executed: else { end of block | 0 | ||||||||||||
| 295 | QMessageLogger(__FILE__, 404, __PRETTY_FUNCTION__).warning("QEGLPlatformContext: eglMakeCurrent failed: %x", eglGetError()); | - | ||||||||||||
| 296 | } never executed:  end of block | 0 | ||||||||||||
| 297 | - | |||||||||||||
| 298 | return never executed: ok; return ok;never executed:  return ok; | 0 | ||||||||||||
| 299 | } | - | ||||||||||||
| 300 | - | |||||||||||||
| 301 | QEGLPlatformContext::~QEGLPlatformContext() | - | ||||||||||||
| 302 | { | - | ||||||||||||
| 303 | if (m_ownsContext 
 
 | 0 | ||||||||||||
| 304 | eglDestroyContext(m_eglDisplay, m_eglContext); never executed:  eglDestroyContext(m_eglDisplay, m_eglContext); | 0 | ||||||||||||
| 305 | - | |||||||||||||
| 306 | m_eglContext = ((EGLContext)0); | - | ||||||||||||
| 307 | } never executed:  end of block | 0 | ||||||||||||
| 308 | - | |||||||||||||
| 309 | void QEGLPlatformContext::doneCurrent() | - | ||||||||||||
| 310 | { | - | ||||||||||||
| 311 | eglBindAPI(m_api); | - | ||||||||||||
| 312 | bool ok = eglMakeCurrent(m_eglDisplay, ((EGLSurface)0), ((EGLSurface)0), ((EGLContext)0)); | - | ||||||||||||
| 313 | if (!ok 
 | 0 | ||||||||||||
| 314 | QMessageLogger(__FILE__, 423, __PRETTY_FUNCTION__).warning("QEGLPlatformContext: eglMakeCurrent failed: %x", eglGetError()); never executed:  QMessageLogger(__FILE__, 423, __PRETTY_FUNCTION__).warning("QEGLPlatformContext: eglMakeCurrent failed: %x", eglGetError()); | 0 | ||||||||||||
| 315 | } never executed:  end of block | 0 | ||||||||||||
| 316 | - | |||||||||||||
| 317 | void QEGLPlatformContext::swapBuffers(QPlatformSurface *surface) | - | ||||||||||||
| 318 | { | - | ||||||||||||
| 319 | eglBindAPI(m_api); | - | ||||||||||||
| 320 | EGLSurface eglSurface = eglSurfaceForPlatformSurface(surface); | - | ||||||||||||
| 321 | if (eglSurface != ((EGLSurface)0) 
 | 0 | ||||||||||||
| 322 | bool ok = eglSwapBuffers(m_eglDisplay, eglSurface); | - | ||||||||||||
| 323 | if (!ok 
 | 0 | ||||||||||||
| 324 | QMessageLogger(__FILE__, 433, __PRETTY_FUNCTION__).warning("QEGLPlatformContext: eglSwapBuffers failed: %x", eglGetError()); never executed:  QMessageLogger(__FILE__, 433, __PRETTY_FUNCTION__).warning("QEGLPlatformContext: eglSwapBuffers failed: %x", eglGetError()); | 0 | ||||||||||||
| 325 | } never executed:  end of block | 0 | ||||||||||||
| 326 | } never executed:  end of block | 0 | ||||||||||||
| 327 | - | |||||||||||||
| 328 | void (*QEGLPlatformContext::getProcAddress(const QByteArray &procName)) () | - | ||||||||||||
| 329 | { | - | ||||||||||||
| 330 | eglBindAPI(m_api); | - | ||||||||||||
| 331 | return never executed: eglGetProcAddress(procName.constData()); return eglGetProcAddress(procName.constData());never executed:  return eglGetProcAddress(procName.constData()); | 0 | ||||||||||||
| 332 | } | - | ||||||||||||
| 333 | - | |||||||||||||
| 334 | QSurfaceFormat QEGLPlatformContext::format() const | - | ||||||||||||
| 335 | { | - | ||||||||||||
| 336 | return never executed: m_format; return m_format;never executed:  return m_format; | 0 | ||||||||||||
| 337 | } | - | ||||||||||||
| 338 | - | |||||||||||||
| 339 | EGLContext QEGLPlatformContext::eglContext() const | - | ||||||||||||
| 340 | { | - | ||||||||||||
| 341 | return never executed: m_eglContext; return m_eglContext;never executed:  return m_eglContext; | 0 | ||||||||||||
| 342 | } | - | ||||||||||||
| 343 | - | |||||||||||||
| 344 | EGLDisplay QEGLPlatformContext::eglDisplay() const | - | ||||||||||||
| 345 | { | - | ||||||||||||
| 346 | return never executed: m_eglDisplay; return m_eglDisplay;never executed:  return m_eglDisplay; | 0 | ||||||||||||
| 347 | } | - | ||||||||||||
| 348 | - | |||||||||||||
| 349 | EGLConfig QEGLPlatformContext::eglConfig() const | - | ||||||||||||
| 350 | { | - | ||||||||||||
| 351 | return never executed: m_eglConfig; return m_eglConfig;never executed:  return m_eglConfig; | 0 | ||||||||||||
| 352 | } | - | ||||||||||||
| 353 | - | |||||||||||||
| 354 | - | |||||||||||||
| Switch to Source code | Preprocessed file |