From 45f7c1f0a078cc41f2fa8ef5cc2ee4fd298be3f9 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 1 Jun 2026 16:39:11 +0200 Subject: [PATCH] Add detecting Vulkan SDK version --- .../Vulkan/GraphicsDeviceVulkan.Build.cs | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Source/Engine/GraphicsDevice/Vulkan/GraphicsDeviceVulkan.Build.cs b/Source/Engine/GraphicsDevice/Vulkan/GraphicsDeviceVulkan.Build.cs index fb200a505..dc55c21e3 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/GraphicsDeviceVulkan.Build.cs +++ b/Source/Engine/GraphicsDevice/Vulkan/GraphicsDeviceVulkan.Build.cs @@ -71,10 +71,33 @@ public sealed class VulkanSdk : Sdk { if (Directory.Exists(vulkanSdk)) { + // Detect version (read core header beginning to find a specific line) + Version = new Version(1, 0); + try + { + using (var stream = File.OpenRead(Path.Combine(vulkanSdk, "Include/vulkan/vulkan_core.h"))) + using (var reader = new StreamReader(stream, System.Text.Encoding.UTF8, true, 1024)) + { + string line; + while ((line = reader.ReadLine()) != null) + { + if (line.StartsWith("#define VK_HEADER_VERSION_COMPLETE")) + { + var parts = line.Split(','); + Version = new Version(int.Parse(parts[1]), int.Parse(parts[2])); + break; + } + } + } + } + catch (Exception) + { + // Ignore errors + } + // Found RootPath = vulkanSdk; IsValid = true; - Version = new Version(1, 0); // TODO: detecting Vulkan SDK version Log.Verbose("Found VulkanSDK at: " + vulkanSdk); } else