upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/vulkan_backend.h
diff options
context:
space:
mode:
authorAsh Hopkins <ashleighhopkins87@gmail.com>2026-11-22 11:25:05 +0000
committerAsh Hopkins <ashleighhopkins87@gmail.com>2026-11-22 12:54:04 +0000
commit6eb5bce3920b68006e6058a48aab5938f3f59a8b (patch)
treec819d8c6155e98c5db25569c3f899621a37353a4 /runtime/src/vulkan_backend.h
parent41f448261e1de8a410b4d760e69a7e5656cef858 (diff)
runtime: accept a Vulkan 1.2 device with the dynamic rendering and synchronization2 extensions
The D3D12 layer and its GPU tests took only Vulkan 1.3 devices, for dynamicRendering and synchronization2. CrossOver's MoltenVK on macOS (1.2.10, the driver its Wine uses) is Vulkan 1.2 with VK_KHR_dynamic_rendering and VK_KHR_synchronization2, the same features under their extension names, so every Vulkan-backed test skipped there. src/vulkan13_features.h picks the core features on 1.3 and the two extensions on 1.2, and device_proc_or_khr falls back to the ...KHR entry points (vkCmdPipelineBarrier2KHR, vkCmdBeginRenderingKHR), which a 1.2 device serves instead of the core names. The translated shaders are SPIR-V 1.5 validated for Vulkan 1.2 already. On a 1.3 device the feature chain is the one it was. Tested in a CrossOver Preview arm64 bottle (FEX) on an Apple M2 Max, cross-built with clang-cl 22.1.8 and xwin: against main at the same commit, no test that passed fails, and d3d12_com, d3d12_multithread, d3d12_method_variants, d3d12_uav_clear, d3d12_debug_markers, d3d12_fence_timing, d3d12_sampler2, d3d12_typeless_rtv, d3d12_predicated_copy and depth24_convert now run and pass. Ten more now run and fail: comparisons with Wine's host D3D12, and MoltenVK 1.2.10 limits (vk_binary_occlusion and vk_overlapping_occlusion fail the same way natively on that driver and pass on MoltenVK 1.4.2). The 1.3 path of create_vulkan_device_standalone was not run on a 1.3 device here. AI-assisted. No game files.
Diffstat (limited to 'runtime/src/vulkan_backend.h')
-rw-r--r--runtime/src/vulkan_backend.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/src/vulkan_backend.h b/runtime/src/vulkan_backend.h
index 7006911c2..245aad6bb 100644
--- a/runtime/src/vulkan_backend.h
+++ b/runtime/src/vulkan_backend.h
@@ -3,7 +3,8 @@
3// The execution side of the D3D12 layer, without COM: the per-device Vulkan context (resources, layout tracker, 3// The execution side of the D3D12 layer, without COM: the per-device Vulkan context (resources, layout tracker,
4// image views), queues that execute command lists, and timeline-semaphore fences. The COM objects in 4// image views), queues that execute command lists, and timeline-semaphore fences. The COM objects in
5// shims/d3d12_com.cpp are thin wrappers over these. Needs Vulkan 1.2 timeline semaphores; rectangle clears and 5// shims/d3d12_com.cpp are thin wrappers over these. Needs Vulkan 1.2 timeline semaphores; rectangle clears and
6// enhanced barriers need the Vulkan 1.3 functions (dynamicRendering, synchronization2) to be enabled. 6// enhanced barriers need the Vulkan 1.3 functions (dynamicRendering, synchronization2) to be enabled, as core
7// features or through their KHR extensions on a 1.2 device (vulkan13_features.h).
7 8
8#ifndef VK_NO_PROTOTYPES 9#ifndef VK_NO_PROTOTYPES
9#define VK_NO_PROTOTYPES 10#define VK_NO_PROTOTYPES
@@ -11,6 +12,7 @@
11#include "binary_occlusion_spirv.h" 12#include "binary_occlusion_spirv.h"
12#include "occlusion_sum_spirv.h" 13#include "occlusion_sum_spirv.h"
13#include "statistics_sum_spirv.h" 14#include "statistics_sum_spirv.h"
15#include "vulkan13_features.h"
14#include "vulkan_depth24.h" 16#include "vulkan_depth24.h"
15#include "vulkan_scratch.h" 17#include "vulkan_scratch.h"
16#include "vulkan_replay.h" 18#include "vulkan_replay.h"
@@ -81,7 +83,7 @@ struct VulkanDeviceFunctions {
81 // extension is not enabled, and the query functions are optional (a list that uses queries without them is 83 // extension is not enabled, and the query functions are optional (a list that uses queries without them is
82 // unsupported). The compute and descriptor functions are needed for normalized or summed occlusion results. 84 // unsupported). The compute and descriptor functions are needed for normalized or summed occlusion results.
83 bool load(PFN_vkGetDeviceProcAddr get, VkDevice device) { 85 bool load(PFN_vkGetDeviceProcAddr get, VkDevice device) {
84#define LEONIDA_VK_LOAD(name) name = reinterpret_cast<PFN_##name>(get(device, #name)); 86#define LEONIDA_VK_LOAD(name) name = reinterpret_cast<PFN_##name>(leonida::device_proc_or_khr(get, device, #name));
85 LEONIDA_VK_DEVICE_FUNCTIONS(LEONIDA_VK_LOAD) 87 LEONIDA_VK_DEVICE_FUNCTIONS(LEONIDA_VK_LOAD)
86#undef LEONIDA_VK_LOAD 88#undef LEONIDA_VK_LOAD
87 return vkCreateCommandPool && vkDestroyCommandPool && vkAllocateCommandBuffers && vkResetCommandBuffer && 89 return vkCreateCommandPool && vkDestroyCommandPool && vkAllocateCommandBuffers && vkResetCommandBuffer &&