Skip to content

Commit e68e205

Browse files
linesightclaude
andcommitted
fix: embed CEF compatibility.manifest in Windows subprocess.exe
The ANGLE D3D11 GPU process crashed with STATUS_BREAKPOINT (exit_code=-2147483645) on Windows because subprocess.exe was linked with /MANIFEST:NO and had no supportedOS=Win10 GUID. Verified end-to-end: with the manifest absent, --use-angle=d3d11 produces 3 GPU CHECK crashes and falls back to software rendering; with CEF's compatibility.manifest embedded via /MANIFEST:EMBED /MANIFESTINPUT, D3D11 init succeeds and NVIDIA GPU is detected. The previous workaround (silently defaulting use-angle=gl on Windows) is removed because it is no longer needed; ANGLE GL is documented as a slower, less-tested fallback by upstream CEF. The build references CEF's own tests/cefsimple/win/compatibility.manifest rather than vendoring a copy, so any future change CEF makes to the supportedOS chain is picked up automatically on the next CEF bump. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7ae0553 commit e68e205

2 files changed

Lines changed: 33 additions & 11 deletions

File tree

src/cefpython.pyx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -567,16 +567,6 @@ def Initialize(applicationSettings=None, commandLineSwitches=None, **kwargs):
567567
if not application_settings["cache_path"]:
568568
g_commandLineSwitches["disable-gpu-shader-disk-cache"] = ""
569569

570-
if sys.platform == "win32":
571-
# CEF 146 / Chrome 130+ ANGLE D3D11 backend crashes with a CHECK
572-
# failure (STATUS_BREAKPOINT / exit_code=-2147483645) during GPU
573-
# process init, falling back to software rendering after 3 crashes.
574-
# D3D9 avoids the crash but only supports ES 2.0 (ES 3.0 errors).
575-
# OpenGL ANGLE supports ES 3.0 and has no crash. Users can override
576-
# by passing {"use-angle": "d3d11"} in the switches dict.
577-
if "use-angle" not in g_commandLineSwitches:
578-
g_commandLineSwitches["use-angle"] = "gl"
579-
580570
IF UNAME_SYSNAME == "Linux":
581571
# Detect Wayland/X11 mode and apply switches BEFORE gtk_init so we
582572
# know whether to open a GTK/X11 display connection at all.

src/subprocess/CMakeLists.txt

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,31 @@ foreach(_f IN LISTS _filtered_all)
105105
endif()
106106
endforeach()
107107

108+
if(WIN32)
109+
# Locate CEF's stock compatibility.manifest from the unpacked binary
110+
# distribution. `tools/download_cef.py` extracts the distrib to
111+
# build/cef_binary_<full-version>_windows64/; this is always present
112+
# when a from-source build runs (automate.py --prebuilt-cef requires
113+
# the same directory).
114+
file(GLOB _cef_binary_candidates LIST_DIRECTORIES true
115+
"${CMAKE_SOURCE_DIR}/build/cef_binary_*_windows64")
116+
set(_cef_binary_distrib "")
117+
foreach(_d IN LISTS _cef_binary_candidates)
118+
if(IS_DIRECTORY "${_d}")
119+
set(_cef_binary_distrib "${_d}")
120+
break()
121+
endif()
122+
endforeach()
123+
set(_cef_compat_manifest
124+
"${_cef_binary_distrib}/tests/cefsimple/win/compatibility.manifest")
125+
if(NOT EXISTS "${_cef_compat_manifest}")
126+
message(FATAL_ERROR
127+
"compatibility.manifest not found under build/cef_binary_*_windows64/.\n"
128+
"Run `python tools/download_cef.py` to extract the CEF distribution.")
129+
endif()
130+
message(STATUS "Subprocess manifest input: ${_cef_compat_manifest}")
131+
endif()
132+
108133
add_executable(cefpython_subprocess ${_exe_sources})
109134
add_dependencies(cefpython_subprocess cefpython_headers)
110135
set_target_properties(cefpython_subprocess PROPERTIES OUTPUT_NAME "subprocess")
@@ -133,8 +158,15 @@ if(WIN32)
133158
"${CEFPYTHON_CEF_ROOT}/lib/libcef.lib"
134159
"${CEFPYTHON_CEF_ROOT}/lib/VS2015/libcef_dll_wrapper_MT.lib"
135160
)
161+
# Embed CEF's compatibility.manifest as RT_MANIFEST so Chromium's
162+
# ANGLE D3D11 GPU process init does not crash with STATUS_BREAKPOINT
163+
# (exit_code=-2147483645). The linker merges /MANIFESTINPUT with its
164+
# auto-generated trustInfo block and embeds the result as resource
165+
# id 1, identical to a hand-written subprocess.rc but driven by CMake.
136166
target_link_options(cefpython_subprocess PRIVATE
137-
/MANIFEST:NO /LARGEADDRESSAWARE /SUBSYSTEM:WINDOWS
167+
/MANIFEST:EMBED
168+
"/MANIFESTINPUT:${_cef_compat_manifest}"
169+
/LARGEADDRESSAWARE /SUBSYSTEM:WINDOWS
138170
)
139171
elseif(APPLE)
140172
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64")

0 commit comments

Comments
 (0)