summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsglcontext.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-01-10 17:17:12 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-22 12:12:17 +0100
commitdb51ffc0d1fbce85fd542403812fab8783c53e3c (patch)
tree2e7a051dbf6701b477e4c19de014a44dbaf84c37 /src/plugins/platforms/windows/qwindowsglcontext.cpp
parenta5c288ea5675a382edf0b3ecae42f461a22a7303 (diff)
Port Windows QPA plugin to new logger API.
Introduce logging categories and change most debug statements to qCDebug(). Retrieve the filter rules from the environment variable QT_QPA_VERBOSE (should be removed once the logging framework offers a more convenient way of configuring). Replace the old per-category variables controlling verboseness of the output by a single variable which can be set on the command line. Change-Id: Iae55ecdb0e150efd165b7d3e90b371f72853f194 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsglcontext.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp63
1 files changed, 28 insertions, 35 deletions
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index 281f54a9d9..b046879314 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -223,7 +223,7 @@ static void describeFormats(HDC hdc)
PIXELFORMATDESCRIPTOR pfd;
initPixelFormatDescriptor(&pfd);
DescribePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
- qDebug() << '#' << i << '/' << pfiMax << ':' << pfd;
+ qCDebug(lcQpaGl) << '#' << i << '/' << pfiMax << ':' << pfd;
}
}
@@ -341,10 +341,8 @@ static int choosePixelFormat(HDC hdc, const QSurfaceFormat &format,
bestPfi = pfi;
*obtainedPfd = checkPfd;
}
- if (QWindowsContext::verboseGL)
- qDebug() << __FUNCTION__ << " checking " << pfi << '/' << pfiMax
- << " score=" << score << " (best " << bestPfi << '/' << bestScore
- << ") " << checkPfd;
+ qCDebug(lcQpaGl) << __FUNCTION__ << " checking " << pfi << '/' << pfiMax
+ << " score=" << score << " (best " << bestPfi << '/' << bestScore << ") " << checkPfd;
}
} // for
if (bestPfi > 0)
@@ -471,15 +469,15 @@ static int choosePixelFormat(HDC hdc,
initPixelFormatDescriptor(obtainedPfd);
DescribePixelFormat(hdc, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), obtainedPfd);
if (!isAcceptableFormat(additional, *obtainedPfd, true)) {
- if (QWindowsContext::verboseGL)
- qDebug() << __FUNCTION__ << " obtained px #" << pixelFormat
- << " not acceptable=" << *obtainedPfd;
+ qCDebug(lcQpaGl) << __FUNCTION__ << " obtained px #" << pixelFormat
+ << " not acceptable=" << *obtainedPfd;
pixelFormat = 0;
}
#ifndef QT_NO_DEBUG_OUTPUT
- if (QWindowsContext::verboseGL) {
- QDebug nsp = qDebug().nospace();
+ if (lcQpaGl().isDebugEnabled()) {
+ QString message;
+ QDebug nsp(&message);
nsp << __FUNCTION__;
if (sampleBuffersRequested)
nsp << " samples=" << iAttributes[samplesValuePosition];
@@ -488,6 +486,7 @@ static int choosePixelFormat(HDC hdc,
nsp << iAttributes[ii] << ',';
nsp << noshowbase << dec << "\n obtained px #" << pixelFormat
<< " of " << numFormats << "\n " << *obtainedPfd;
+ qCDebug(lcQpaGl) << message;
} // Debug
#endif
@@ -611,9 +610,8 @@ static HGLRC createContext(const QOpenGLStaticContext &staticContext,
break;
}
}
- if (QWindowsContext::verboseGL)
- qDebug("%s: Creating context version %d.%d with %d attributes",
- __FUNCTION__, majorVersion, minorVersion, attribIndex / 2);
+ qCDebug(lcQpaGl) << __FUNCTION__ << "Creating context version"
+ << majorVersion << '.' << minorVersion << attribIndex / 2 << "attributes";
const HGLRC result =
staticContext.wglCreateContextAttribsARB(hdc, shared, attributes);
@@ -842,8 +840,7 @@ QOpenGLStaticContext *QOpenGLStaticContext::create()
if (!wglGetCurrentContext())
temporaryContext.reset(new QOpenGLTemporaryContext);
QOpenGLStaticContext *result = new QOpenGLStaticContext;
- if (QWindowsContext::verboseGL)
- qDebug() << __FUNCTION__ << *result;
+ qCDebug(lcQpaGl) << __FUNCTION__ << *result;
return result;
}
@@ -857,7 +854,7 @@ QDebug operator<<(QDebug d, const QOpenGLStaticContext &s)
if (s.hasExtensions())
nsp << ", Extension-API present";
nsp << "\nExtensions: " << (s.extensionNames.count(' ') + 1);
- if (QWindowsContext::verboseGL > 1)
+ if (QWindowsContext::verbose > 1)
nsp << s.extensionNames;
return d;
}
@@ -917,7 +914,7 @@ QWindowsGLContext::QWindowsGLContext(const QOpenGLStaticContextPtr &staticContex
if (!hdc)
break;
- if (QWindowsContext::verboseGL > 1)
+ if (QWindowsContext::verbose > 1)
describeFormats(hdc);
// Preferably use direct rendering and ARB extensions (unless pixmap
// or explicitly turned off on command line).
@@ -991,14 +988,12 @@ QWindowsGLContext::QWindowsGLContext(const QOpenGLStaticContextPtr &staticContex
if (dummyWindow)
DestroyWindow(dummyWindow);
- if (QWindowsContext::verboseGL)
- qDebug() << __FUNCTION__ << this << (tryExtensions ? "ARB" : "GDI")
- << " requested: " << context->format()
- << "\n obtained #" << m_pixelFormat << (m_extensionsUsed ? "ARB" : "GDI")
- << m_obtainedFormat << "\n " << m_obtainedPixelFormatDescriptor
- << " swap interval: " << obtainedSwapInternal
- << "\n default: " << m_staticContext->defaultFormat
- << "\n HGLRC=" << m_renderingContext;
+ qCDebug(lcQpaGl()) << __FUNCTION__ << this << (tryExtensions ? "ARB" : "GDI")
+ << " requested: " << context->format()
+ << "\n obtained #" << m_pixelFormat << (m_extensionsUsed ? "ARB" : "GDI") << m_obtainedFormat
+ << "\n " << m_obtainedPixelFormatDescriptor << " swap interval: " << obtainedSwapInternal
+ << "\n default: " << m_staticContext->defaultFormat
+ << "\n HGLRC=" << m_renderingContext;
}
QWindowsGLContext::~QWindowsGLContext()
@@ -1039,8 +1034,8 @@ static inline const QOpenGLContextData *
void QWindowsGLContext::swapBuffers(QPlatformSurface *surface)
{
- if (QWindowsContext::verboseGL > 1)
- qDebug() << __FUNCTION__ << surface;
+ if (QWindowsContext::verbose > 1)
+ qCDebug(lcQpaGl) << __FUNCTION__ << surface;
if (const QOpenGLContextData *contextData = findByHWND(m_windowContexts, handleOf(surface))) {
SwapBuffers(contextData->hdc);
} else {
@@ -1051,8 +1046,8 @@ void QWindowsGLContext::swapBuffers(QPlatformSurface *surface)
bool QWindowsGLContext::makeCurrent(QPlatformSurface *surface)
{
#ifdef DEBUG_GL
- if (QWindowsContext::verboseGL > 1)
- qDebug("%s context=%p contexts=%d", __FUNCTION__, this, m_windowContexts.size());
+ if (QWindowsContext::verbose > 1)
+ qCDebug(lcQpaGl) << __FUNCTION__ << this << m_windowContexts.size() << "contexts";
#endif // DEBUG_GL
Q_ASSERT(surface->surface()->surfaceType() == QSurface::OpenGLSurface);
@@ -1105,8 +1100,8 @@ bool QWindowsGLContext::makeCurrent(QPlatformSurface *surface)
void QWindowsGLContext::doneCurrent()
{
#ifdef DEBUG_GL
- if (QWindowsContext::verboseGL > 1)
- qDebug("%s context=%p %d contexts", __FUNCTION__, this, m_windowContexts.size());
+ if (QWindowsContext::verbose > 1)
+ qCDebug(lcQpaGl) << __FUNCTION__ << this << m_windowContexts.size() << "contexts";
#endif // DEBUG_GL
wglMakeCurrent(0, 0);
releaseDCs();
@@ -1116,10 +1111,8 @@ QWindowsGLContext::GL_Proc QWindowsGLContext::getProcAddress(const QByteArray &p
{
// TODO: Will that work with the calling conventions?
GL_Proc procAddress = reinterpret_cast<GL_Proc>(wglGetProcAddress(procName.constData()));
- if (QWindowsContext::verboseGL > 1)
- qDebug("%s('%s') with current_hglrc=%p returns %p",
- __FUNCTION__, procName.constData(),
- wglGetCurrentContext(), procAddress);
+ if (QWindowsContext::verbose > 1)
+ qCDebug(lcQpaGl) << __FUNCTION__ << procName << wglGetCurrentContext() << "returns" << procAddress;
if (!procAddress)
qWarning("%s: Unable to resolve '%s'", __FUNCTION__, procName.constData());
return procAddress;