solenv/gbuild/ExternalProject.mk | 1 vcl/inc/win/saldata.hxx | 2 vcl/source/opengl/OpenGLContext.cxx | 59 +++++++++++++++-------------- vcl/source/opengl/OpenGLHelper.cxx | 2 vcl/win/source/window/salframe.cxx | 73 ++++++++---------------------------- 5 files changed, 52 insertions(+), 85 deletions(-)
New commits: commit d6b765015b26362d7d8db9a4a0f7659c177acd38 Author: Jan Holesovsky <ke...@collabora.com> Date: Mon Nov 17 14:51:56 2014 +0100 windows opengl: Setup the VirtualDevice so that SetPixelFormat succeeds. Without this, I'm getting a strange 0xc0070006 error from SetPixelFormat. Change-Id: I6df6168a7d29d59272849e177a8e463fa5cef807 diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index 0914449..3ec1415 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -754,39 +754,31 @@ bool OpenGLContext::init(HDC hDC, HWND hWnd) bool OpenGLContext::ImplInit() { SAL_INFO("vcl.opengl", "OpenGLContext::ImplInit----start"); + // PixelFormat tells Windows how we want things to be - PIXELFORMATDESCRIPTOR PixelFormatFront = - { - sizeof(PIXELFORMATDESCRIPTOR), - 1, // Version Number - PFD_SUPPORT_OPENGL, - PFD_TYPE_RGBA, // Request An RGBA Format - (BYTE)32, // Select Our Color Depth - 0, 0, 0, 0, 0, 0, // Color Bits Ignored - 0, // No Alpha Buffer - 0, // Shift Bit Ignored - 0, // No Accumulation Buffer - 0, 0, 0, 0, // Accumulation Bits Ignored - 64, // 32 bit Z-BUFFER - 0, // 0 bit stencil buffer - 0, // No Auxiliary Buffer - 0, // now ignored - 0, // Reserved - 0, 0, 0 // Layer Masks Ignored - }; + PIXELFORMATDESCRIPTOR pfd; + ZeroMemory(&pfd, sizeof(pfd)); + + pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); + pfd.nVersion = 1; + pfd.dwFlags = PFD_SUPPORT_OPENGL; + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.cColorBits = 24; + pfd.cDepthBits = 32; + pfd.iLayerType = PFD_MAIN_PLANE; // interestingly we need this flag being set even if we use single buffer // rendering - otherwise we get errors with virtual devices - PixelFormatFront.dwFlags |= PFD_DOUBLEBUFFER; + pfd.dwFlags |= PFD_DOUBLEBUFFER; if (mbRequestVirtualDevice) - PixelFormatFront.dwFlags |= PFD_DRAW_TO_BITMAP; + pfd.dwFlags |= PFD_DRAW_TO_BITMAP | PFD_SUPPORT_GDI; else - PixelFormatFront.dwFlags |= PFD_DRAW_TO_WINDOW; + pfd.dwFlags |= PFD_DRAW_TO_WINDOW; // we must check whether can set the MSAA int WindowPix = 0; - bool bMultiSampleSupport = InitMultisample(PixelFormatFront, WindowPix, + bool bMultiSampleSupport = InitMultisample(pfd, WindowPix, mbUseDoubleBufferedRendering, mbRequestVirtualDevice); if (bMultiSampleSupport && WindowPix != 0) { @@ -794,7 +786,7 @@ bool OpenGLContext::ImplInit() } else { - WindowPix = ChoosePixelFormat(m_aGLWin.hDC, &PixelFormatFront); + WindowPix = ChoosePixelFormat(m_aGLWin.hDC, &pfd); } if (WindowPix == 0) @@ -803,7 +795,7 @@ bool OpenGLContext::ImplInit() return false; } - if (!SetPixelFormat(m_aGLWin.hDC, WindowPix, &PixelFormatFront)) + if (!SetPixelFormat(m_aGLWin.hDC, WindowPix, &pfd)) { ImplWriteLastError(GetLastError(), "SetPixelFormat in OpenGLContext::ImplInit"); SAL_WARN("vcl.opengl", "SetPixelFormat failed"); commit 60d80d6248e14ecd5bda607fc708ffd2b90fe49f Author: Jan Holesovsky <ke...@collabora.com> Date: Mon Nov 17 12:29:56 2014 +0100 windows: Improve logging. Change-Id: I15e6d240b3c94af07e9b39cc16efb581869729f2 diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx index e1ae8cc..2c0731e 100644 --- a/vcl/inc/win/saldata.hxx +++ b/vcl/inc/win/saldata.hxx @@ -183,7 +183,7 @@ LRESULT CALLBACK SalFrameWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM l void EmitTimerCallback(); void SalTestMouseLeave(); -bool ImplWriteLastError( DWORD lastError, const char *szApiCall ); +void ImplWriteLastError(DWORD lastError, const char *szApiCall); long ImplHandleSalObjKeyMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ); long ImplHandleSalObjSysCharMsg( HWND hWnd, WPARAM wParam, LPARAM lParam ); diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index fbadeac..0914449 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -23,6 +23,10 @@ #include <postmac.h> #endif +#if defined( WNT ) +#include <win/saldata.hxx> +#endif + using namespace com::sun::star; #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID @@ -200,8 +204,6 @@ bool WGLisExtensionSupported(const char *extension) if ((p==supported || p[-1]==' ') && (p[extlen]=='\0' || p[extlen]==' ')) return 1; // Match } - - CHECK_GL_ERROR(); } bool InitMultisample(PIXELFORMATDESCRIPTOR pfd, int& rPixelFormat, @@ -752,7 +754,8 @@ bool OpenGLContext::init(HDC hDC, HWND hWnd) bool OpenGLContext::ImplInit() { SAL_INFO("vcl.opengl", "OpenGLContext::ImplInit----start"); - PIXELFORMATDESCRIPTOR PixelFormatFront = // PixelFormat Tells Windows How We Want Things To Be + // PixelFormat tells Windows how we want things to be + PIXELFORMATDESCRIPTOR PixelFormatFront = { sizeof(PIXELFORMATDESCRIPTOR), 1, // Version Number @@ -800,17 +803,25 @@ bool OpenGLContext::ImplInit() return false; } - SetPixelFormat(m_aGLWin.hDC, WindowPix, &PixelFormatFront); + if (!SetPixelFormat(m_aGLWin.hDC, WindowPix, &PixelFormatFront)) + { + ImplWriteLastError(GetLastError(), "SetPixelFormat in OpenGLContext::ImplInit"); + SAL_WARN("vcl.opengl", "SetPixelFormat failed"); + return false; + } + m_aGLWin.hRC = wglCreateContext(m_aGLWin.hDC); if (m_aGLWin.hRC == NULL) { + ImplWriteLastError(GetLastError(), "wglCreateContext in OpenGLContext::ImplInit"); SAL_WARN("vcl.opengl", "wglCreateContext failed"); return false; } if (!wglMakeCurrent(m_aGLWin.hDC, m_aGLWin.hRC)) { - SAL_WARN("vcl.opengl", "wglMakeCurrent failed: " << GetLastError()); + ImplWriteLastError(GetLastError(), "wglMakeCurrent in OpenGLContext::ImplInit"); + SAL_WARN("vcl.opengl", "wglMakeCurrent failed"); return false; } diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 9dd008b..31d9186 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -5978,64 +5978,27 @@ bool ImplHandleGlobalMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LR return bResult; } -bool ImplWriteLastError( DWORD lastError, const char *szApiCall ) +void ImplWriteLastError(DWORD lastError, const char *szApiCall) { - static int first=1; - // if VCL_LOGFILE_ENABLED is set, Win32 API error messages can be written - // to %TMP%/vcl.log or %TEMP%/vcl.log - static char *logEnabled = getenv("VCL_LOGFILE_ENABLED"); - if( logEnabled ) - { - bool bSuccess = FALSE; - static char *szTmp = getenv("TMP"); - if( !szTmp || !*szTmp ) - szTmp = getenv("TEMP"); - if( szTmp && *szTmp ) - { - char fname[5000]; - strcpy( fname, szTmp ); - if( fname[strlen(fname) - 1] != '\\' ) - strcat( fname, "\\"); - strcat( fname, "vcl.log" ); - FILE *fp = fopen( fname, "a" ); // always append - if( fp ) - { - if( first ) - { - first = 0; - fprintf( fp, "Process ID: %ld (0x%lx)\n", GetCurrentProcessId(), GetCurrentProcessId() ); - } - time_t aclock; - time( &aclock ); // Get time in seconds - struct tm *newtime = localtime( &aclock ); // Convert time to struct tm form - fprintf( fp, asctime( newtime ) ); // print time stamp - - fprintf( fp, "%s returned %lu (0x%lx)\n", szApiCall, lastError, lastError ); - bSuccess = TRUE; // may be FormatMessage fails but we wrote at least the error code - - LPVOID lpMsgBuf; - if (FormatMessageA( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - lastError, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPSTR) &lpMsgBuf, - 0, - NULL )) - { - fprintf( fp, " %s\n", (LPSTR)lpMsgBuf ); - LocalFree( lpMsgBuf ); - } - - fclose( fp ); - } - } - return bSuccess; +#if OSL_DEBUG_LEVEL > 0 + LPVOID lpMsgBuf; + if (FormatMessageA( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + lastError & 0xffff, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &lpMsgBuf, + 0, + NULL )) + { + SAL_WARN("vcl", "API call: " << szApiCall << " returned " << lastError << " (0x" << std::hex << lastError << "): " << (LPTSTR) lpMsgBuf); + LocalFree(lpMsgBuf); } else - return TRUE; + SAL_WARN("vcl", "API call: " << szApiCall << " returned " << lastError << " (0x" << std::hex << lastError << ")"); +#endif } #ifdef _WIN32 commit cd5a95aa73b022223535d6d457222850e2baa229 Author: Jan Holesovsky <ke...@collabora.com> Date: Mon Nov 17 00:28:29 2014 +0100 opengl: Do not check for OpenGL errors in a loop. Can lead to an infinite loop. Change-Id: I09863959719115aec23534ac72a9a9690af3aeb9 diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index bbcaefd..89c534e 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -353,7 +353,7 @@ float OpenGLHelper::getGLVersion() void OpenGLHelper::checkGLError(const char* pFile, size_t nLine) { GLenum glErr = glGetError(); - while (glErr != GL_NO_ERROR) + if (glErr != GL_NO_ERROR) { const char* sError = OpenGLHelper::GLErrorString(glErr); commit 603de6bc396819d084f23e1493a4e0b50c8e600c Author: Jan Holesovsky <ke...@collabora.com> Date: Sun Nov 16 00:11:38 2014 +0100 windows: msbuild gets completely confused when the 'Platform' envvar is set. Change-Id: Iea04859c6afa203bd6b527b99c680ff4176cf9e1 diff --git a/solenv/gbuild/ExternalProject.mk b/solenv/gbuild/ExternalProject.mk index f6e8cfc..292d2d1 100644 --- a/solenv/gbuild/ExternalProject.mk +++ b/solenv/gbuild/ExternalProject.mk @@ -212,6 +212,7 @@ define gb_ExternalProject_run $(if $(findstring YES,$(UNPACKED_IS_BIN_TARBALL)),\ touch $@, $(call gb_Helper_print_on_error,cd $(EXTERNAL_WORKDIR)/$(3) && \ + unset Platform && \ $(if $(WRAPPERS),export $(WRAPPERS) &&) \ $(if $(NMAKE),INCLUDE="$(gb_ExternalProject_INCLUDE)" LIB="$(ILIB)" MAKEFLAGS=) \ $(2) && touch $@,$(EXTERNAL_WORKDIR)/$(if $(3),$(3)/,)$(if $(4),$(4),$(1).log)) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits