diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bad8fa98..abcf71b43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,8 +137,6 @@ if(SFML_USE_SYSTEM_DEPS) endforeach() list(REMOVE_DUPLICATES CMAKE_IGNORE_PATH) -elseif(SFML_COMPILER_GCC AND GCC_COMPILER_VERSION MATCHES "ucrt") - message(FATAL_ERROR "The pre-compiled SFML dependencies for MinGW are not compatible with the UCRT. Either switch to the MSVCRT or build the dependencies yourself.") endif() if(SFML_COMPILER_MSVC) @@ -387,13 +385,15 @@ if(SFML_OS_WINDOWS) if(NOT SFML_USE_SYSTEM_DEPS) # install the binaries of SFML dependencies - if(ARCH_32BITS) + if(ARCH_ARM64) + install(DIRECTORY extlibs/libs-msvc-universal/ARM64/ DESTINATION ${CMAKE_INSTALL_LIBDIR}) + elseif(ARCH_X86) if(SFML_COMPILER_MSVC OR (SFML_COMPILER_CLANG AND NOT MINGW)) install(DIRECTORY extlibs/libs-msvc-universal/x86/ DESTINATION ${CMAKE_INSTALL_LIBDIR}) else() install(DIRECTORY extlibs/libs-mingw/x86/ DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() - elseif(ARCH_64BITS) + elseif(ARCH_X64) if(SFML_COMPILER_MSVC OR (SFML_COMPILER_CLANG AND NOT MINGW)) install(DIRECTORY extlibs/libs-msvc-universal/x64/ DESTINATION ${CMAKE_INSTALL_LIBDIR}) else() diff --git a/cmake/Config.cmake b/cmake/Config.cmake index 07c956c1b..35dc26ede 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -6,10 +6,14 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") set(OPENGL_ES 0) # detect the architecture - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - set(ARCH_32BITS 1) + if(${CMAKE_GENERATOR_PLATFORM} MATCHES "ARM64") + set(ARCH_ARM64 1) + elseif("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "" AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "ARM64") + set(ARCH_ARM64 1) + elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(ARCH_X86 1) elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(ARCH_64BITS 1) + set(ARCH_X64 1) else() message(FATAL_ERROR "Unsupported architecture") return() @@ -87,11 +91,21 @@ if(MSVC) endif() elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(SFML_COMPILER_CLANG 1) + + execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-v" OUTPUT_VARIABLE CLANG_COMPILER_VERSION ERROR_VARIABLE CLANG_COMPILER_VERSION) + + if("${CLANG_COMPILER_VERSION}" MATCHES "ucrt") + set(SFML_RUNTIME_UCRT 1) + endif() elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") set(SFML_COMPILER_GCC 1) - execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE GCC_COMPILER_VERSION) + execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-v" OUTPUT_VARIABLE GCC_COMPILER_VERSION ERROR_VARIABLE GCC_COMPILER_VERSION) string(REGEX MATCHALL ".*(tdm[64]*-[1-9]).*" SFML_COMPILER_GCC_TDM "${GCC_COMPILER_VERSION}") + + if("${GCC_COMPILER_VERSION}" MATCHES "ucrt") + set(SFML_RUNTIME_UCRT 1) + endif() else() message(WARNING "Unrecognized compiler: ${CMAKE_CXX_COMPILER_ID}. Use at your own risk.") endif() diff --git a/cmake/Mesa3D.cmake b/cmake/Mesa3D.cmake index 60539ed6b..485db274d 100644 --- a/cmake/Mesa3D.cmake +++ b/cmake/Mesa3D.cmake @@ -4,10 +4,12 @@ set(MESA3D_SHA256 "FEF8A643689414A70347AE8027D24674DEFD85E8D6428C8A9D4145BB3F44A get_filename_component(MESA3D_ARCHIVE "${MESA3D_URL}" NAME) get_filename_component(MESA3D_ARCHIVE_DIRECTORY "${MESA3D_URL}" NAME_WLE) -if(${ARCH_64BITS}) +if(${ARCH_X64}) set(MESA3D_ARCH "x64") -else() +elseif(${ARCH_X86}) set(MESA3D_ARCH "x86") +else() + message(FATAL_ERROR "Mesa 3D does currently not support the target architecture.") endif() set(MESA3D_ARCHIVE_PATH "${PROJECT_BINARY_DIR}/${MESA3D_ARCHIVE_DIRECTORY}/${MESA3D_ARCHIVE}") diff --git a/extlibs/libs-mingw-ucrt/x64/libFLAC.a b/extlibs/libs-mingw-ucrt/x64/libFLAC.a new file mode 100644 index 000000000..523c71963 Binary files /dev/null and b/extlibs/libs-mingw-ucrt/x64/libFLAC.a differ diff --git a/extlibs/libs-mingw-ucrt/x64/libfreetype.a b/extlibs/libs-mingw-ucrt/x64/libfreetype.a new file mode 100644 index 000000000..a1e5ed574 Binary files /dev/null and b/extlibs/libs-mingw-ucrt/x64/libfreetype.a differ diff --git a/extlibs/libs-mingw-ucrt/x86/libFLAC.a b/extlibs/libs-mingw-ucrt/x86/libFLAC.a new file mode 100644 index 000000000..bea890ae1 Binary files /dev/null and b/extlibs/libs-mingw-ucrt/x86/libFLAC.a differ diff --git a/extlibs/libs-mingw-ucrt/x86/libfreetype.a b/extlibs/libs-mingw-ucrt/x86/libfreetype.a new file mode 100644 index 000000000..71eac0d41 Binary files /dev/null and b/extlibs/libs-mingw-ucrt/x86/libfreetype.a differ diff --git a/extlibs/libs-msvc-universal/ARM64/flac.lib b/extlibs/libs-msvc-universal/ARM64/flac.lib new file mode 100644 index 000000000..e8e4c4ded Binary files /dev/null and b/extlibs/libs-msvc-universal/ARM64/flac.lib differ diff --git a/extlibs/libs-msvc-universal/ARM64/freetype.lib b/extlibs/libs-msvc-universal/ARM64/freetype.lib new file mode 100644 index 000000000..a56097437 Binary files /dev/null and b/extlibs/libs-msvc-universal/ARM64/freetype.lib differ diff --git a/extlibs/libs-msvc-universal/ARM64/ogg.lib b/extlibs/libs-msvc-universal/ARM64/ogg.lib new file mode 100644 index 000000000..6bfefb350 Binary files /dev/null and b/extlibs/libs-msvc-universal/ARM64/ogg.lib differ diff --git a/extlibs/libs-msvc-universal/ARM64/vorbis.lib b/extlibs/libs-msvc-universal/ARM64/vorbis.lib new file mode 100644 index 000000000..d59f33b9a Binary files /dev/null and b/extlibs/libs-msvc-universal/ARM64/vorbis.lib differ diff --git a/extlibs/libs-msvc-universal/ARM64/vorbisenc.lib b/extlibs/libs-msvc-universal/ARM64/vorbisenc.lib new file mode 100644 index 000000000..a700b1de6 Binary files /dev/null and b/extlibs/libs-msvc-universal/ARM64/vorbisenc.lib differ diff --git a/extlibs/libs-msvc-universal/ARM64/vorbisfile.lib b/extlibs/libs-msvc-universal/ARM64/vorbisfile.lib new file mode 100644 index 000000000..dba0d3255 Binary files /dev/null and b/extlibs/libs-msvc-universal/ARM64/vorbisfile.lib differ diff --git a/src/SFML/CMakeLists.txt b/src/SFML/CMakeLists.txt index 4874325f5..3118b9c86 100644 --- a/src/SFML/CMakeLists.txt +++ b/src/SFML/CMakeLists.txt @@ -5,16 +5,26 @@ include(${PROJECT_SOURCE_DIR}/cmake/Macros.cmake) if(SFML_OS_WINDOWS) list(APPEND CMAKE_INCLUDE_PATH "${PROJECT_SOURCE_DIR}/extlibs/headers") if(SFML_COMPILER_GCC OR (SFML_COMPILER_CLANG AND MINGW)) - if(ARCH_32BITS) - list(APPEND CMAKE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw/x86") - elseif(ARCH_64BITS) - list(APPEND CMAKE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw/x64") + if(ARCH_X86) + if(SFML_RUNTIME_UCRT) + # taking precendence for provided libraries linking UCRT + list(APPEND CMAKE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw-ucrt/x86") + endif() + set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw/x86") + elseif(ARCH_X64) + if(SFML_RUNTIME_UCRT) + # taking precendence for provided libraries linking UCRT + list(APPEND CMAKE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw-ucrt/x64") + endif() + set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw/x64") endif() elseif(SFML_COMPILER_MSVC OR (SFML_COMPILER_CLANG AND NOT MINGW)) - if(ARCH_32BITS) - list(APPEND CMAKE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc-universal/x86") - elseif(ARCH_64BITS) - list(APPEND CMAKE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc-universal/x64") + if(ARCH_ARM64) + set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc-universal/ARM64") + elseif(ARCH_X86) + set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc-universal/x86") + elseif(ARCH_X64) + set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc-universal/x64") endif() endif() elseif(SFML_OS_MACOS) diff --git a/src/SFML/Window/CMakeLists.txt b/src/SFML/Window/CMakeLists.txt index c311e37bc..9149d7e13 100644 --- a/src/SFML/Window/CMakeLists.txt +++ b/src/SFML/Window/CMakeLists.txt @@ -66,6 +66,7 @@ if(SFML_OS_WINDOWS) ${SRCROOT}/Win32/JoystickImpl.hpp ${SRCROOT}/Win32/SensorImpl.hpp ${SRCROOT}/Win32/SensorImpl.cpp + ${SRCROOT}/Win32/Utils.hpp ${SRCROOT}/Win32/VideoModeImpl.cpp ${SRCROOT}/Win32/VulkanImplWin32.cpp ${SRCROOT}/Win32/WindowImplWin32.cpp diff --git a/src/SFML/Window/Win32/ClipboardImpl.cpp b/src/SFML/Window/Win32/ClipboardImpl.cpp index 33c90b854..98527517b 100644 --- a/src/SFML/Window/Win32/ClipboardImpl.cpp +++ b/src/SFML/Window/Win32/ClipboardImpl.cpp @@ -26,6 +26,7 @@ // Headers //////////////////////////////////////////////////////////// #include +#include #include #include @@ -45,13 +46,13 @@ String ClipboardImpl::getString() if (!IsClipboardFormatAvailable(CF_UNICODETEXT)) { - err() << "Failed to get the clipboard data in Unicode format." << std::endl; + err() << "Failed to get the clipboard data in Unicode format: " << getErrorString(GetLastError()) << std::endl; return text; } if (!OpenClipboard(nullptr)) { - err() << "Failed to open the Win32 clipboard." << std::endl; + err() << "Failed to open the Win32 clipboard: " << getErrorString(GetLastError()) << std::endl; return text; } @@ -59,7 +60,7 @@ String ClipboardImpl::getString() if (!clipboardHandle) { - err() << "Failed to get Win32 handle for clipboard content." << std::endl; + err() << "Failed to get Win32 handle for clipboard content: " << getErrorString(GetLastError()) << std::endl; CloseClipboard(); return text; } @@ -77,13 +78,14 @@ void ClipboardImpl::setString(const String& text) { if (!OpenClipboard(nullptr)) { - err() << "Failed to open the Win32 clipboard." << std::endl; + err() << "Failed to open the Win32 clipboard: " << getErrorString(GetLastError()) << std::endl; return; } if (!EmptyClipboard()) { - err() << "Failed to empty the Win32 clipboard." << std::endl; + err() << "Failed to empty the Win32 clipboard: " << getErrorString(GetLastError()) << std::endl; + CloseClipboard(); return; } diff --git a/src/SFML/Window/Win32/JoystickImpl.cpp b/src/SFML/Window/Win32/JoystickImpl.cpp index 5fc11f547..6fef970b6 100644 --- a/src/SFML/Window/Win32/JoystickImpl.cpp +++ b/src/SFML/Window/Win32/JoystickImpl.cpp @@ -26,6 +26,7 @@ // Headers //////////////////////////////////////////////////////////// #include +#include #include #include @@ -116,25 +117,6 @@ ConnectionCache connectionCache[sf::Joystick::Count]; // If true, will only update when WM_DEVICECHANGE message is received bool lazyUpdates = false; -// Get a system error string from an error code -std::string getErrorString(DWORD error) -{ - PTCHAR buffer = nullptr; - - if (FormatMessage(FORMAT_MESSAGE_MAX_WIDTH_MASK | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - nullptr, - error, - 0, - reinterpret_cast(&buffer), - 0, - nullptr) == 0) - return "Unknown error."; - - const sf::String message = buffer; - LocalFree(buffer); - return message.toAnsiString(); -} - // Get the joystick's name sf::String getDeviceName(unsigned int index, JOYCAPS caps) { @@ -163,7 +145,7 @@ sf::String getDeviceName(unsigned int index, JOYCAPS caps) if (result != ERROR_SUCCESS) { sf::err() << "Unable to open registry for joystick at index " << index << ": " - << getErrorString(static_cast(result)) << std::endl; + << sf::priv::getErrorString(static_cast(result)) << std::endl; return joystickDescription; } } @@ -184,7 +166,7 @@ sf::String getDeviceName(unsigned int index, JOYCAPS caps) if (result != ERROR_SUCCESS) { sf::err() << "Unable to query registry key for joystick at index " << index << ": " - << getErrorString(static_cast(result)) << std::endl; + << sf::priv::getErrorString(static_cast(result)) << std::endl; return joystickDescription; } @@ -197,7 +179,7 @@ sf::String getDeviceName(unsigned int index, JOYCAPS caps) if (result != ERROR_SUCCESS) { sf::err() << "Unable to open registry key for joystick at index " << index << ": " - << getErrorString(static_cast(result)) << std::endl; + << sf::priv::getErrorString(static_cast(result)) << std::endl; return joystickDescription; } @@ -209,7 +191,7 @@ sf::String getDeviceName(unsigned int index, JOYCAPS caps) if (result != ERROR_SUCCESS) { sf::err() << "Unable to query name for joystick at index " << index << ": " - << getErrorString(static_cast(result)) << std::endl; + << sf::priv::getErrorString(static_cast(result)) << std::endl; return joystickDescription; } diff --git a/src/SFML/Window/Win32/Utils.hpp b/src/SFML/Window/Win32/Utils.hpp new file mode 100644 index 000000000..7771032aa --- /dev/null +++ b/src/SFML/Window/Win32/Utils.hpp @@ -0,0 +1,53 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#pragma once + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + +namespace sf::priv +{ +inline std::string getErrorString(DWORD error) +{ + PTCHAR buffer = nullptr; + if (FormatMessage(FORMAT_MESSAGE_MAX_WIDTH_MASK | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + nullptr, + error, + 0, + reinterpret_cast(&buffer), + 0, + nullptr) == 0) + { + return "Unknown error."; + } + + const sf::String message = buffer; + LocalFree(buffer); + return message.toAnsiString(); +} +} // namespace sf::priv diff --git a/src/SFML/Window/Win32/WglContext.cpp b/src/SFML/Window/Win32/WglContext.cpp index e394c0a4f..ffcde3ed7 100644 --- a/src/SFML/Window/Win32/WglContext.cpp +++ b/src/SFML/Window/Win32/WglContext.cpp @@ -27,6 +27,7 @@ //////////////////////////////////////////////////////////// #include #include +#include #include #include @@ -100,30 +101,6 @@ void ensureExtensionsInit(HDC deviceContext) namespace sf::priv { -//////////////////////////////////////////////////////////// -String getErrorString(DWORD errorCode) -{ - PTCHAR buffer = nullptr; - if (FormatMessage(FORMAT_MESSAGE_MAX_WIDTH_MASK | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - nullptr, - errorCode, - 0, - reinterpret_cast(&buffer), - 256, - nullptr) != 0) - { - String errMsg(buffer); - LocalFree(buffer); - return errMsg; - } - - std::ostringstream ss; - ss << "Error " << errorCode; - return {ss.str()}; -} - - //////////////////////////////////////////////////////////// WglContext::WglContext(WglContext* shared) : WglContext(shared, ContextSettings{}, {1u, 1u}) { @@ -234,7 +211,7 @@ bool WglContext::makeCurrent(bool current) if (wglMakeCurrent(m_deviceContext, current ? m_context : nullptr) == FALSE) { err() << "Failed to " << (current ? "activate" : "deactivate") - << " OpenGL context: " << getErrorString(GetLastError()).toAnsiString() << std::endl; + << " OpenGL context: " << getErrorString(GetLastError()) << std::endl; return false; } @@ -261,7 +238,7 @@ void WglContext::setVerticalSyncEnabled(bool enabled) if (SF_GLAD_WGL_EXT_swap_control) { if (wglSwapIntervalEXT(enabled ? 1 : 0) == FALSE) - err() << "Setting vertical sync failed: " << getErrorString(GetLastError()).toAnsiString() << std::endl; + err() << "Setting vertical sync failed: " << getErrorString(GetLastError()) << std::endl; } else { @@ -335,7 +312,7 @@ int WglContext::selectBestPixelFormat(HDC deviceContext, unsigned int bitsPerPix const bool isValid = wglChoosePixelFormatARB(deviceContext, intAttributes, nullptr, 512, formats, &nbFormats) != FALSE; if (!isValid) - err() << "Failed to enumerate pixel formats: " << getErrorString(GetLastError()).toAnsiString() << std::endl; + err() << "Failed to enumerate pixel formats: " << getErrorString(GetLastError()) << std::endl; // Get the best format among the returned ones if (isValid && (nbFormats > 0)) @@ -355,8 +332,7 @@ int WglContext::selectBestPixelFormat(HDC deviceContext, unsigned int bitsPerPix if (wglGetPixelFormatAttribivARB(deviceContext, formats[i], PFD_MAIN_PLANE, 7, attributes, values) == FALSE) { - err() << "Failed to retrieve pixel format information: " - << getErrorString(GetLastError()).toAnsiString() << std::endl; + err() << "Failed to retrieve pixel format information: " << getErrorString(GetLastError()) << std::endl; break; } @@ -369,7 +345,7 @@ int WglContext::selectBestPixelFormat(HDC deviceContext, unsigned int bitsPerPix FALSE) { err() << "Failed to retrieve pixel format multisampling information: " - << getErrorString(GetLastError()).toAnsiString() << std::endl; + << getErrorString(GetLastError()) << std::endl; break; } } @@ -383,7 +359,7 @@ int WglContext::selectBestPixelFormat(HDC deviceContext, unsigned int bitsPerPix FALSE) { err() << "Failed to retrieve pixel format sRGB capability information: " - << getErrorString(GetLastError()).toAnsiString() << std::endl; + << getErrorString(GetLastError()) << std::endl; break; } } @@ -397,8 +373,8 @@ int WglContext::selectBestPixelFormat(HDC deviceContext, unsigned int bitsPerPix if (wglGetPixelFormatAttribivARB(deviceContext, formats[i], PFD_MAIN_PLANE, 1, pbufferAttributes, &pbufferValue) == FALSE) { - err() << "Failed to retrieve pixel format pbuffer information: " - << getErrorString(GetLastError()).toAnsiString() << std::endl; + err() << "Failed to retrieve pixel format pbuffer information: " << getErrorString(GetLastError()) + << std::endl; break; } @@ -467,8 +443,7 @@ void WglContext::setDevicePixelFormat(unsigned int bitsPerPixel) if (bestFormat == 0) { - err() << "Failed to find a suitable pixel format for device context: " - << getErrorString(GetLastError()).toAnsiString() << '\n' + err() << "Failed to find a suitable pixel format for device context: " << getErrorString(GetLastError()) << '\n' << "Cannot create OpenGL context" << std::endl; return; } @@ -482,7 +457,7 @@ void WglContext::setDevicePixelFormat(unsigned int bitsPerPixel) // Set the chosen pixel format if (SetPixelFormat(m_deviceContext, bestFormat, &actualFormat) == FALSE) { - err() << "Failed to set pixel format for device context: " << getErrorString(GetLastError()).toAnsiString() << '\n' + err() << "Failed to set pixel format for device context: " << getErrorString(GetLastError()) << '\n' << "Cannot create OpenGL context" << std::endl; return; } @@ -496,7 +471,7 @@ void WglContext::updateSettingsFromPixelFormat() if (format == 0) { - err() << "Failed to get selected pixel format: " << getErrorString(GetLastError()).toAnsiString() << std::endl; + err() << "Failed to get selected pixel format: " << getErrorString(GetLastError()) << std::endl; return; } @@ -506,8 +481,7 @@ void WglContext::updateSettingsFromPixelFormat() if (DescribePixelFormat(m_deviceContext, format, sizeof(actualFormat), &actualFormat) == 0) { - err() << "Failed to retrieve pixel format information: " << getErrorString(GetLastError()).toAnsiString() - << std::endl; + err() << "Failed to retrieve pixel format information: " << getErrorString(GetLastError()) << std::endl; return; } @@ -537,8 +511,7 @@ void WglContext::updateSettingsFromPixelFormat() } else { - err() << "Failed to retrieve pixel format information: " << getErrorString(GetLastError()).toAnsiString() - << std::endl; + err() << "Failed to retrieve pixel format information: " << getErrorString(GetLastError()) << std::endl; m_settings.depthBits = actualFormat.cDepthBits; m_settings.stencilBits = actualFormat.cStencilBits; } @@ -555,8 +528,8 @@ void WglContext::updateSettingsFromPixelFormat() } else { - err() << "Failed to retrieve pixel format multisampling information: " - << getErrorString(GetLastError()).toAnsiString() << std::endl; + err() << "Failed to retrieve pixel format multisampling information: " << getErrorString(GetLastError()) + << std::endl; m_settings.antialiasingLevel = 0; } } @@ -577,8 +550,8 @@ void WglContext::updateSettingsFromPixelFormat() } else { - err() << "Failed to retrieve pixel format sRGB capability information: " - << getErrorString(GetLastError()).toAnsiString() << std::endl; + err() << "Failed to retrieve pixel format sRGB capability information: " << getErrorString(GetLastError()) + << std::endl; m_settings.sRgbCapable = false; } } @@ -621,8 +594,8 @@ void WglContext::createSurface(WglContext* shared, const Vector2u& size, unsigne if (!m_deviceContext) { - err() << "Failed to retrieve pixel buffer device context: " - << getErrorString(GetLastError()).toAnsiString() << std::endl; + err() << "Failed to retrieve pixel buffer device context: " << getErrorString(GetLastError()) + << std::endl; wglDestroyPbufferARB(m_pbuffer); m_pbuffer = nullptr; @@ -630,7 +603,7 @@ void WglContext::createSurface(WglContext* shared, const Vector2u& size, unsigne } else { - err() << "Failed to create pixel buffer: " << getErrorString(GetLastError()).toAnsiString() << std::endl; + err() << "Failed to create pixel buffer: " << getErrorString(GetLastError()) << std::endl; } } } @@ -746,8 +719,8 @@ void WglContext::createContext(WglContext* shared) { if (wglMakeCurrent(shared->m_deviceContext, nullptr) == FALSE) { - err() << "Failed to deactivate shared context before sharing: " - << getErrorString(GetLastError()).toAnsiString() << std::endl; + err() << "Failed to deactivate shared context before sharing: " << getErrorString(GetLastError()) + << std::endl; return; } @@ -802,8 +775,7 @@ void WglContext::createContext(WglContext* shared) m_context = wglCreateContext(m_deviceContext); if (!m_context) { - err() << "Failed to create an OpenGL context for this window: " - << getErrorString(GetLastError()).toAnsiString() << std::endl; + err() << "Failed to create an OpenGL context for this window: " << getErrorString(GetLastError()) << std::endl; return; } @@ -818,8 +790,8 @@ void WglContext::createContext(WglContext* shared) { if (wglMakeCurrent(shared->m_deviceContext, nullptr) == FALSE) { - err() << "Failed to deactivate shared context before sharing: " - << getErrorString(GetLastError()).toAnsiString() << std::endl; + err() << "Failed to deactivate shared context before sharing: " << getErrorString(GetLastError()) + << std::endl; return; } @@ -827,8 +799,7 @@ void WglContext::createContext(WglContext* shared) } if (wglShareLists(sharedContext, m_context) == FALSE) - err() << "Failed to share the OpenGL context: " << getErrorString(GetLastError()).toAnsiString() - << std::endl; + err() << "Failed to share the OpenGL context: " << getErrorString(GetLastError()) << std::endl; } }