Windows QPA: Also wrap DescribePixelFormat()
GDI and the software rendering opengl32sw.dll may have very different pixel formats so use wglDescribePixelFormat() in that case. This mirrors the existing behavior for SetPixelFormat(). Change-Id: I55e658ab69bad84bb10cc5a042d62e84c005c0e6 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>bb10
parent
c9291cbfd6
commit
e77877f207
|
|
@ -196,6 +196,7 @@ bool QWindowsOpengl32DLL::init(bool softwareRendering)
|
|||
wglShareLists = reinterpret_cast<BOOL (WINAPI *)(HGLRC, HGLRC)>(resolve("wglShareLists"));
|
||||
wglSwapBuffers = reinterpret_cast<BOOL (WINAPI *)(HDC)>(resolve("wglSwapBuffers"));
|
||||
wglSetPixelFormat = reinterpret_cast<BOOL (WINAPI *)(HDC, int, const PIXELFORMATDESCRIPTOR *)>(resolve("wglSetPixelFormat"));
|
||||
wglDescribePixelFormat = reinterpret_cast<int (WINAPI *)(HDC, int, UINT, PIXELFORMATDESCRIPTOR *)>(resolve("wglDescribePixelFormat"));
|
||||
|
||||
glGetError = reinterpret_cast<GLenum (APIENTRY *)()>(resolve("glGetError"));
|
||||
glGetIntegerv = reinterpret_cast<void (APIENTRY *)(GLenum , GLint *)>(resolve("glGetIntegerv"));
|
||||
|
|
@ -214,6 +215,11 @@ BOOL QWindowsOpengl32DLL::setPixelFormat(HDC dc, int pf, const PIXELFORMATDESCRI
|
|||
return moduleIsNotOpengl32() ? wglSetPixelFormat(dc, pf, pfd) : SetPixelFormat(dc, pf, pfd);
|
||||
}
|
||||
|
||||
int QWindowsOpengl32DLL::describePixelFormat(HDC dc, int pf, UINT size, PIXELFORMATDESCRIPTOR *pfd)
|
||||
{
|
||||
return moduleIsNotOpengl32() ? wglDescribePixelFormat(dc, pf, size, pfd) : DescribePixelFormat(dc, pf, size, pfd);
|
||||
}
|
||||
|
||||
QWindowsOpenGLContext *QOpenGLStaticContext::createContext(QOpenGLContext *context)
|
||||
{
|
||||
return new QWindowsGLContext(this, context);
|
||||
|
|
@ -322,11 +328,11 @@ static inline bool
|
|||
|
||||
static void describeFormats(HDC hdc)
|
||||
{
|
||||
const int pfiMax = DescribePixelFormat(hdc, 0, 0, nullptr);
|
||||
const int pfiMax = QOpenGLStaticContext::opengl32.describePixelFormat(hdc, 0, 0, nullptr);
|
||||
for (int i = 0; i < pfiMax; i++) {
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
initPixelFormatDescriptor(&pfd);
|
||||
DescribePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||
QOpenGLStaticContext::opengl32.describePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||
qCDebug(lcQpaGl) << '#' << i << '/' << pfiMax << ':' << pfd;
|
||||
}
|
||||
}
|
||||
|
|
@ -617,7 +623,7 @@ static int choosePixelFormat(HDC hdc,
|
|||
// Verify if format is acceptable. Note that the returned
|
||||
// formats have been observed to not contain PFD_SUPPORT_OPENGL, ignore.
|
||||
initPixelFormatDescriptor(obtainedPfd);
|
||||
DescribePixelFormat(hdc, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), obtainedPfd);
|
||||
QOpenGLStaticContext::opengl32.describePixelFormat(hdc, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), obtainedPfd);
|
||||
if (!isAcceptableFormat(additional, *obtainedPfd, true)) {
|
||||
qCDebug(lcQpaGl) << __FUNCTION__ << " obtained px #" << pixelFormat
|
||||
<< " not acceptable=" << *obtainedPfd;
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ struct QWindowsOpengl32DLL
|
|||
// Wrappers. Always use these instead of SwapBuffers/wglSwapBuffers/etc.
|
||||
BOOL swapBuffers(HDC dc);
|
||||
BOOL setPixelFormat(HDC dc, int pf, const PIXELFORMATDESCRIPTOR *pfd);
|
||||
int describePixelFormat(HDC dc, int pf, UINT size, PIXELFORMATDESCRIPTOR *pfd);
|
||||
|
||||
// WGL
|
||||
HGLRC (WINAPI * wglCreateContext)(HDC dc);
|
||||
|
|
@ -130,6 +131,7 @@ private:
|
|||
// For Mesa llvmpipe shipped with a name other than opengl32.dll
|
||||
BOOL (WINAPI * wglSwapBuffers)(HDC dc);
|
||||
BOOL (WINAPI * wglSetPixelFormat)(HDC dc, int pf, const PIXELFORMATDESCRIPTOR *pfd);
|
||||
int (WINAPI * wglDescribePixelFormat)(HDC dc, int pf, UINT size, PIXELFORMATDESCRIPTOR *pfd);
|
||||
};
|
||||
|
||||
class QOpenGLStaticContext : public QWindowsStaticOpenGLContext
|
||||
|
|
|
|||
Loading…
Reference in New Issue