stride3d/stride · error · InvalidOperationException
No Vulkan physical device
Error message
No Vulkan physical device
What it means
PickPhysicalDevice enumerates Vulkan physical devices after instance creation and throws when vkEnumeratePhysicalDevices reports count == 0 — the Vulkan loader works but no ICD provided any device. Thrown from the test harness's EnsureSharedContext path, so the whole Vulkan rendering test cannot run.
Solutions
- Install a Vulkan ICD: on Linux e.g. mesa-vulkan-drivers (Lavapipe) or the vendor driver package
- Verify with `vulkaninfo --summary` that at least one physical device appears
- Fix VK_ICD_FILENAMES / VK_DRIVER_FILES pointing at valid .icd.json files
- Enable softwareRendering so the harness accepts a CPU (Lavapipe) device
- Skip the Vulkan test path when no device exists (the harness's `available` check)
Example fix
// before
var devices = frameRenderer.RunVulkanTest();
// after
if (FrameRenderer.VulkanAvailable == false)
{
Assert.Skip("No Vulkan device available");
return;
}
var devices = frameRenderer.RunVulkanTest(); Defensive patterns
Strategy: fallback
Validate before calling
uint count = 0; bool HasVulkanDevice() => instanceApi.vkEnumeratePhysicalDevices(instance, &count, null) == VkResult.Success && count > 0;
Try / catch
try { EnsureSharedContext(); }
catch (InvalidOperationException ex) when (ex.Message.Contains("No Vulkan physical device"))
{
Assert.Skip("No Vulkan device; skipping Vulkan rendering test");
} Prevention
- Install an ICD (mesa-vulkan-drivers or vendor driver) in test environments
- Verify with vulkaninfo before running the suite
- Set VK_ICD_FILENAMES correctly in containers
- Offer a software-rendering fallback path
When it happens
Trigger: vkEnumeratePhysicalDevices(instance, &count, null) returns Success but count stays 0 — no driver/ICD installed, or all ICDs were filtered out (bad VK_ICD_FILENAMES, headless container, broken driver install).
Common situations: CI containers without mesa-vulkan-drivers or GPU ICDs; Windows machines without a GPU vendor driver; broken Vulkan loader configuration; running inside WSL without GPU passthrough configured.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- No graphics+compute queue family
- No Vulkan 1.2+ physical device
- Vulkan: Failed to find GPUs with Vulkan support
- AHardwareBuffer import requires…
- argumentsBuffer
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/f5751ce70624701c.
Report an issue: GitHub.
Appendix: source
Thrown at sources/shaders/Stride.Shaders.Tests/FrameRenderer.Vulkan.cs:145
pApplicationInfo = &appInfo,
};
var result = vkCreateInstance(&createInfo, out VkInstance createdInstance);
if (result == VkResult.ErrorIncompatibleDriver)
{
appInfo.apiVersion = VkVersion.Version_1_2;
result = vkCreateInstance(&createInfo, out createdInstance);
}
Check(result, "vkCreateInstance");
instance = createdInstance;
instanceApi = GetApi(instance);
}
private static void PickPhysicalDevice()
{
uint count = 0;
Check(instanceApi.vkEnumeratePhysicalDevices(instance, &count, null));
if (count == 0)
throw new InvalidOperationException("No Vulkan physical device");
var devices = new VkPhysicalDevice[count];
fixed (VkPhysicalDevice* devicesPtr = devices)
Check(instanceApi.vkEnumeratePhysicalDevices(instance, &count, devicesPtr));
// SPIR-V 1.4 modules require a Vulkan 1.2+ device.
// Software rendering (see Module) selects a CPU device (Lavapipe); otherwise prefer real GPUs.
var softwareRendering = Environment.GetEnvironmentVariable("STRIDE_GRAPHICS_SOFTWARE_RENDERING") == "1";
var best = -1;
var bestScore = -1;
for (int i = 0; i < count; i++)
{
instanceApi.vkGetPhysicalDeviceProperties(devices[i], out var properties);
if (properties.apiVersion < VkVersion.Version_1_2)
continue;
var isCpu = properties.deviceType == VkPhysicalDeviceType.Cpu;
var score = softwareRendering
? (isCpu ? 3 : 0)
: properties.deviceType switchView on GitHub (pinned to 96fad776d2)