Meta: Use Direct3D instead of Vulkan on Windows

Windows has a platform-native GPU stack based around Direct3D and DXGI.
The browser's Windows integration will need to share GPU resources with
Skia, ANGLE, and the UI process through that stack, especially when
backing stores move from bitmap readback to shared handles. Keeping
Vulkan as the Windows backend would put painting on a parallel API that
does not match the resources the rest of the native Windows pipeline
needs to exchange.
This commit is contained in:
Aliaksandr Kalenik 2026-06-15 02:31:09 +02:00 committed by Alexander Kalenik
parent 1f36340419
commit d858c7219b
2 changed files with 31 additions and 5 deletions

View file

@ -46,7 +46,7 @@ if (NOT APPLE AND NOT ANDROID AND NOT WIN32)
add_cxx_compile_definitions(USE_FONTCONFIG=1)
endif()
if (NOT APPLE)
if (NOT APPLE AND NOT WIN32)
find_package(VulkanHeaders CONFIG QUIET)
find_package(Vulkan QUIET)
find_program(GLSLANG_VALIDATOR glslangValidator)
@ -58,8 +58,16 @@ if (NOT APPLE)
if (((LINUX AND NOT ANDROID) OR BSD) AND GLSLANG_VALIDATOR)
set(USE_VULKAN_DMABUF_IMAGES ON CACHE BOOL "" FORCE)
add_cxx_compile_definitions(USE_VULKAN_DMABUF_IMAGES=1)
else()
set(USE_VULKAN_DMABUF_IMAGES OFF CACHE BOOL "" FORCE)
endif()
else()
set(HAS_VULKAN OFF CACHE BOOL "" FORCE)
set(USE_VULKAN_DMABUF_IMAGES OFF CACHE BOOL "" FORCE)
endif()
else()
set(HAS_VULKAN OFF CACHE BOOL "" FORCE)
set(USE_VULKAN_DMABUF_IMAGES OFF CACHE BOOL "" FORCE)
endif()
find_package(CURL REQUIRED)
@ -127,3 +135,16 @@ else()
set_property(TARGET PkgConfig::skia APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "SKCMS_DLL")
endif()
add_library(skia ALIAS ${SKIA_TARGET})
if (WIN32)
get_target_property(SKIA_COMPILE_DEFINITIONS ${SKIA_TARGET} INTERFACE_COMPILE_DEFINITIONS)
if (SKIA_COMPILE_DEFINITIONS AND "${SKIA_COMPILE_DEFINITIONS}" MATCHES "SK_DIRECT3D")
set(HAS_DIRECTX ON CACHE BOOL "" FORCE)
add_cxx_compile_definitions(USE_DIRECTX=1)
else()
set(HAS_DIRECTX OFF CACHE BOOL "" FORCE)
message(WARNING "Skia was not built with Direct3D support; Windows GPU painting will be disabled")
endif()
else()
set(HAS_DIRECTX OFF CACHE BOOL "" FORCE)
endif()

View file

@ -150,7 +150,7 @@
"freetype",
"harfbuzz",
"icu",
"vulkan"
"direct3d"
]
},
{
@ -180,8 +180,14 @@
"zstd"
]
},
"vulkan",
"vulkan-headers",
{
"name": "vulkan",
"platform": "linux | bsd | android"
},
{
"name": "vulkan-headers",
"platform": "linux | bsd | android"
},
"woff2",
"wuffs",
"zlib"
@ -254,7 +260,6 @@
"pcre2",
"png",
"thread",
"vulkan",
"widgets",
"zstd"
]