From 8a6d706d770867bc76d31633f176037da30e9cf4 Mon Sep 17 00:00:00 2001 From: Alaska Date: Thu, 24 Jul 2025 09:15:52 +0200 Subject: [PATCH] Utilities: Add batch files to help launch Blender with different GPU backends With Vulkan now having general feature parity with OpenGL, but with some stability issues, it has become more important to offer ways for users to quickly launch Blender with the OpenGL or Vulkan backend in case Blender is unable to open with one of them. This commit adds three new batch files to help with this: - `blender_factory_startup_vulkan.cmd` - Launches Blender with factory settings, but with Vulkan enabled. Useful for helping test if a Vulkan crash at startup is related to a addon. - `blender_startup_opengl.cmd` - Simply launches Blender with the OpenGL backend. It does not change any other settings. Useful in case a user has complex user preferences, enabled Vulkan for testing, and now Blender crashes on startup. Now they want to switch back to OpenGL and they don't want to lose their complex user preferences by using `blender_factory_startup.cmd` - `blender_startup_vulkan.cmd` - Simply launches Blender with the Vulkan backend. It does not change any other settings. Useful for people that encounter #127835 after a Windows update. This issue can be worked around by using Vulkan. But if you are experiencing the issue and are on the OpenGL backend, you can't use the Blender interface and so you can't easily switch to the Vulkan backend without the command line or a script like this. Pull Request: https://projects.blender.org/blender/blender/pulls/142169 --- .../batch/blender_factory_startup_vulkan.cmd | 20 +++++++++++++++++++ .../windows/batch/blender_startup_opengl.cmd | 4 ++++ .../windows/batch/blender_startup_vulkan.cmd | 4 ++++ source/creator/CMakeLists.txt | 3 +++ 4 files changed, 31 insertions(+) create mode 100644 release/windows/batch/blender_factory_startup_vulkan.cmd create mode 100644 release/windows/batch/blender_startup_opengl.cmd create mode 100644 release/windows/batch/blender_startup_vulkan.cmd diff --git a/release/windows/batch/blender_factory_startup_vulkan.cmd b/release/windows/batch/blender_factory_startup_vulkan.cmd new file mode 100644 index 00000000000..73c7e95ab9d --- /dev/null +++ b/release/windows/batch/blender_factory_startup_vulkan.cmd @@ -0,0 +1,20 @@ +@echo off +echo Starting blender with factory settings, log files will be created +echo in your temp folder, windows explorer will open after you close blender +echo to help you find them. +echo. +echo If you report a bug on https://projects.blender.org you can attach these files +echo by dragging them into the text area of your bug report, please include both +echo blender_debug_output.txt and blender_system_info.txt in your report. +echo. +pause +echo. +echo Starting blender and waiting for it to exit.... +setlocal + +set PYTHONPATH= +set DEBUGLOGS="%temp%\blender\debug_logs" +mkdir "%DEBUGLOGS%" > NUL 2>&1 + +"%~dp0\blender" --factory-startup --gpu-backend vulkan --python-expr "import bpy; bpy.context.preferences.filepaths.temporary_directory=r'%DEBUGLOGS%'; bpy.ops.wm.sysinfo(filepath=r'%DEBUGLOGS%\blender_system_info.txt')" > "%DEBUGLOGS%\blender_debug_output.txt" 2>&1 < %0 +explorer "%DEBUGLOGS%" diff --git a/release/windows/batch/blender_startup_opengl.cmd b/release/windows/batch/blender_startup_opengl.cmd new file mode 100644 index 00000000000..98c71530646 --- /dev/null +++ b/release/windows/batch/blender_startup_opengl.cmd @@ -0,0 +1,4 @@ +@echo off +echo Starting Blender with the OpenGL backend + +"%~dp0\blender" --gpu-backend opengl diff --git a/release/windows/batch/blender_startup_vulkan.cmd b/release/windows/batch/blender_startup_vulkan.cmd new file mode 100644 index 00000000000..73c75b2ba85 --- /dev/null +++ b/release/windows/batch/blender_startup_vulkan.cmd @@ -0,0 +1,4 @@ +@echo off +echo Starting Blender with the Vulkan backend + +"%~dp0\blender" --gpu-backend vulkan diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 4a49c7e0f8b..f756f922cca 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -1566,6 +1566,9 @@ elseif(WIN32) ${CMAKE_SOURCE_DIR}/release/windows/batch/blender_debug_gpu_glitchworkaround.cmd ${CMAKE_SOURCE_DIR}/release/windows/batch/blender_debug_log.cmd ${CMAKE_SOURCE_DIR}/release/windows/batch/blender_factory_startup.cmd + ${CMAKE_SOURCE_DIR}/release/windows/batch/blender_factory_startup_vulkan.cmd + ${CMAKE_SOURCE_DIR}/release/windows/batch/blender_startup_opengl.cmd + ${CMAKE_SOURCE_DIR}/release/windows/batch/blender_startup_vulkan.cmd ${CMAKE_SOURCE_DIR}/release/windows/batch/blender_oculus.cmd ${CMAKE_SOURCE_DIR}/release/windows/batch/oculus.json DESTINATION ${TARGETDIR_EXE}