diff --git a/gpt4all-chat/CHANGELOG.md b/gpt4all-chat/CHANGELOG.md index 59bfc0f9..f82cfd43 100644 --- a/gpt4all-chat/CHANGELOG.md +++ b/gpt4all-chat/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ### Fixed - Fix "index N is not a prompt" when using LocalDocs with reasoning ([#3451](https://github.com/nomic-ai/gpt4all/pull/3451) - Fix UI freeze when chat template is `{#` ([#3446](https://github.com/nomic-ai/gpt4all/pull/3446)) +- Work around rendering artifacts on Snapdragon SoCs with Windows ([#3450](https://github.com/nomic-ai/gpt4all/pull/3450)) ## [3.8.0] - 2025-01-30 diff --git a/gpt4all-chat/CMakeLists.txt b/gpt4all-chat/CMakeLists.txt index c0f39ffa..6f6004d8 100644 --- a/gpt4all-chat/CMakeLists.txt +++ b/gpt4all-chat/CMakeLists.txt @@ -35,6 +35,8 @@ option(GPT4ALL_SIGN_INSTALL "Sign installed binaries and installers (requires si option(GPT4ALL_GEN_CPACK_CONFIG "Generate the CPack config.xml in the package step and nothing else." OFF) set(GPT4ALL_USE_QTPDF "AUTO" CACHE STRING "Whether to Use QtPDF for LocalDocs. If OFF or not available on this platform, PDFium is used.") set_property(CACHE GPT4ALL_USE_QTPDF PROPERTY STRINGS AUTO ON OFF) +set(GPT4ALL_FORCE_D3D12 "AUTO" CACHE STRING "Whether to use Direct3D 12 as the Qt scene graph backend. Defaults to ON on Windows ARM.") +set_property(CACHE GPT4ALL_FORCE_D3D12 PROPERTY STRINGS AUTO ON OFF) include(cmake/cpack_config.cmake) @@ -90,12 +92,6 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}") set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) -# Generate a header file with the version number -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.h.in" - "${CMAKE_CURRENT_BINARY_DIR}/config.h" -) - set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL ON) set(GPT4ALL_QT_COMPONENTS Core HttpServer LinguistTools Quick QuickDialogs2 Sql Svg) set(GPT4ALL_USING_QTPDF OFF) @@ -130,6 +126,24 @@ message(STATUS "Qt 6 root directory: ${Qt6_ROOT_DIR}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +set(GPT4ALL_CONFIG_FORCE_D3D12 -1) +if (NOT CMAKE_SYSTEM_NAME MATCHES Windows OR Qt6_VERSION VERSION_LESS "6.6") + # Direct3D 12 is not available. + if (GPT4ALL_FORCE_D3D12 STREQUAL "ON") + message(FATAL_ERROR "Cannot use Direct3D 12 on this platform.") + endif() +elseif (GPT4ALL_FORCE_D3D12 MATCHES "^(ON|AUTO)$") + if (GPT4ALL_FORCE_D3D12 STREQUAL "ON" OR CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|AARCH64|arm64|ARM64)$") + set(GPT4ALL_CONFIG_FORCE_D3D12 1) + endif() +endif() + +# Generate a header file for configuration +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/config.h" +) + add_subdirectory(deps) add_subdirectory(../gpt4all-backend llmodel) diff --git a/gpt4all-chat/cmake/config.h.in b/gpt4all-chat/cmake/config.h.in deleted file mode 100644 index c6b77b5b..00000000 --- a/gpt4all-chat/cmake/config.h.in +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - -#define APP_VERSION "@APP_VERSION@" - -#endif // CONFIG_H diff --git a/gpt4all-chat/src/config.h.in b/gpt4all-chat/src/config.h.in new file mode 100644 index 00000000..c919b4ba --- /dev/null +++ b/gpt4all-chat/src/config.h.in @@ -0,0 +1,7 @@ +#pragma once + +#define APP_VERSION "@APP_VERSION@" + +#define G4A_CONFIG(name) (1/G4A_CONFIG_##name == 1) + +#define G4A_CONFIG_force_d3d12 @GPT4ALL_CONFIG_FORCE_D3D12@ diff --git a/gpt4all-chat/src/main.cpp b/gpt4all-chat/src/main.cpp index 5edf863d..41eb7bb4 100644 --- a/gpt4all-chat/src/main.cpp +++ b/gpt4all-chat/src/main.cpp @@ -25,6 +25,10 @@ #include #include +#if G4A_CONFIG(force_d3d12) +# include +#endif + #ifndef GPT4ALL_USE_QTPDF # include #endif @@ -83,6 +87,10 @@ int main(int argc, char *argv[]) return 0; } +#if G4A_CONFIG(force_d3d12) + QQuickWindow::setGraphicsApi(QSGRendererInterface::Direct3D12); +#endif + #ifdef Q_OS_LINUX app.setWindowIcon(QIcon(":/gpt4all/icons/gpt4all.svg")); #endif