Fix #149631: Storm Vulkan Headless Rendering

This change will allow rendering with storm using Vulkan without WSI. In the
current situation when trying to render using SSH the target system can
still support surfaces, but isn't able to create a surface instance.

This PR changes:
- Do check if an X11 display could be created as the X11 spec mentions
  that it is null when it fails to create a display and the vulkan spec
  mentions that display should be a valid pointer to a display struct.

Pull Request: https://projects.blender.org/blender/blender/pulls/152002
This commit is contained in:
Jeroen Bakker
2026-01-13 16:12:18 +01:00
parent 4effff6311
commit 1032f97576
2 changed files with 36 additions and 1 deletions

View File

@ -151,7 +151,10 @@ ExternalProject_Add(external_usd
${CMAKE_COMMAND} -E remove ${BUILD_DIR}/usd/src/external_usd/pxr/imaging/hgiVulkan/vk_mem_alloc.h && ${CMAKE_COMMAND} -E remove ${BUILD_DIR}/usd/src/external_usd/pxr/imaging/hgiVulkan/vk_mem_alloc.h &&
${PATCH_CMD} -p 1 -d ${PATCH_CMD} -p 1 -d
${BUILD_DIR}/usd/src/external_usd < ${BUILD_DIR}/usd/src/external_usd <
${PATCH_DIR}/usd_storm_vulkan.diff ${PATCH_DIR}/usd_storm_vulkan.diff &&
${PATCH_CMD} -p 1 -d
${BUILD_DIR}/usd/src/external_usd <
${PATCH_DIR}/usd_vulkan_headless_3931.diff
CMAKE_ARGS CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${LIBDIR}/usd -DCMAKE_INSTALL_PREFIX=${LIBDIR}/usd
-Wno-dev -Wno-dev

View File

@ -0,0 +1,32 @@
commit aedfa981065793673eaade6645490aedb043df59
Author: Jeroen Bakker <jeroen@blender.org>
Date: Mon Dec 22 13:39:27 2025 +0100
HgiVulkan: Incorrect Surface Check
The current code only checks if the base surface extension is available,
but doesn't check if the platform specific surface extension is
available. Resulting in the `_hasPresentation` to be set in cases where it
shouldn't.
Detected when trying to render via SSH using Vulkan.
See https://projects.blender.org/blender/blender/issues/149631 for
information.
Revert instance changes
diff --git a/pxr/imaging/hgiVulkan/device.cpp b/pxr/imaging/hgiVulkan/device.cpp
index 4d6c3ec05..6900849a7 100644
--- a/pxr/imaging/hgiVulkan/device.cpp
+++ b/pxr/imaging/hgiVulkan/device.cpp
@@ -62,6 +62,10 @@ _SupportsPresentation(
physicalDevice, familyIndex);
#elif defined(VK_USE_PLATFORM_XLIB_KHR)
Display* dsp = XOpenDisplay(nullptr);
+ // Allow headless rendering
+ if (dsp == nullptr) {
+ return true;
+ }
VisualID visualID = XVisualIDFromVisual(
DefaultVisual(dsp, DefaultScreen(dsp)));
return vkGetPhysicalDeviceXlibPresentationSupportKHR(