feat(vkbridge): emulation layer + VK_KHR_maintenance5 for drivers without it

Zink (Mesa 26.2) and DXVK 2.7 refuse a Vulkan 1.3 device without maintenance5. The server
installs dispatch-table wrappers: flags2 folded into 32-bit flags, inline shader modules,
BindIndexBuffer2/area granularity/subresource layout 2, VK_REMAINING_ARRAY_LAYERS and
VK_WHOLE_SIZE resolved from tracked images/buffers. Host: Zink glxgears in gamescope at
144 fps with the driver's maintenance5 hidden and the API capped at 1.3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KZqR8XUE8czvGzEpgSCVQR
This commit is contained in:
ahmadandClaude Opus 5.5 authored and Ahmad Sayed Alsayed Ebrahim committed 2026-10-10 14:28:13 +03:00
1 parent c3f02222fc
commit bf6dbb642a
7 files changed
+535 -23

No files matched your search

+8 -4
View File
@@ -7,9 +7,12 @@
const VkExtensionProperties *vkb_emu_extensions(vkb_physdev *pd, uint32_t *n)
{
(void)pd;
*n = 0;
return NULL;
static const VkExtensionProperties maint5 = {"VK_KHR_maintenance5", 1};
static __thread VkExtensionProperties list[8];
uint32_t c = 0;
if (pd->info.emu & VKB_EMU_MAINT5) list[c++] = maint5;
*n = c;
return list;
}
void vkb_emu_patch_limits(vkb_physdev *pd, VkPhysicalDeviceProperties *p) { (void)pd; (void)p; }
@@ -17,7 +20,8 @@ void vkb_emu_patch_properties_chain(vkb_physdev *pd, VkBaseOutStructure *b) { (v
void vkb_emu_patch_features(vkb_physdev *pd, VkPhysicalDeviceFeatures *f) { (void)pd; (void)f; }
void vkb_emu_patch_features_chain(vkb_physdev *pd, VkBaseOutStructure *b)
{
(void)pd;
if ((pd->info.emu & VKB_EMU_MAINT5) && b->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES)
((VkPhysicalDeviceMaintenance5Features *)b)->maintenance5 = VK_TRUE;
/* Host image copy hands the driver host pointers: never offered across the bridge. */
if (b->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_4_FEATURES) ((VkPhysicalDeviceVulkan14Features *)b)->hostImageCopy = VK_FALSE;
if (b->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES) ((VkPhysicalDeviceHostImageCopyFeatures *)b)->hostImageCopy = VK_FALSE;
+1
View File
@@ -34,6 +34,7 @@ static inline const char *vkb_mem_strategy_name(uint32_t s)
#define VKB_EMU_CULL_DISTANCE (1u << 3) /* shaderCullDistance (accepted, not applied) */
#define VKB_EMU_POINT_SIZE (1u << 4) /* strip PointSize from geometry/tessellation stages */
#define VKB_EMU_DEPTH_CLIP (1u << 5) /* VK_EXT_depth_clip_enable via depthClamp */
#define VKB_EMU_MAINT5 (1u << 6) /* VK_KHR_maintenance5 on a driver without it */
/* vkbQueryServer reply (per physical device). */
typedef struct vkb_server_pd_info {
+1 -1
View File
@@ -9,5 +9,5 @@ exec docker run --rm ${VKB_DOCKER_EXTRA:-} --tmpfs /run/xdg:mode=0700 \
-e XDG_RUNTIME_DIR=/run/xdg -e WAYLAND_DISPLAY=host-wayland -e HOME=/root \
-v "$R/${WAYLAND_DISPLAY:-wayland-0}:/run/host-wayland" -v "$VKBRIDGE_SOCKET:/run/vkbridge.sock" \
-v "$host/out:$host/out" -v "$host/out/shots:/shots" -e VK_DRIVER_FILES=$host/out/vkbridge_icd.json -e VKBRIDGE_SOCKET=/run/vkbridge.sock \
-e VKBRIDGE_DRM_RENDER=${VKBRIDGE_DRM_RENDER:-} -e VKBRIDGE_LOG_LEVEL=${VKBRIDGE_LOG_LEVEL:-2} -e VKBRIDGE_WSI_DUMP=${VKBRIDGE_WSI_DUMP:-} \
-e VKBRIDGE_DRM_RENDER=${VKBRIDGE_DRM_RENDER:-} -e VKBRIDGE_HIDE_EXTS=${VKBRIDGE_HIDE_EXTS:-} -e VKBRIDGE_MAX_API=${VKBRIDGE_MAX_API:-} -e VKBRIDGE_LOG_LEVEL=${VKBRIDGE_LOG_LEVEL:-2} -e VKBRIDGE_WSI_DUMP=${VKBRIDGE_WSI_DUMP:-} \
vkb-arch-gamescope bash -c "ln -s /run/host-wayland /run/xdg/host-wayland; gamescope --backend wayland --expose-wayland -W 960 -H 540 -w 960 -h 540 -- $cmd"