Harden Vulkan init/device selection and resource teardown

- Remove unconditional VK_KHR_swapchain request; offscreen renderer needs
  no device extensions, fixing failures on headless/CI setups.
- Enumerate physical devices properly and pick the first one with a
  graphics queue family instead of blindly choosing device 0.
- Check vkEnumeratePhysicalDevices/vkBindImageMemory/vkBindBufferMemory
  results.
- Validate FindMemoryType() result before allocation and log clear errors.
- Add a persistent linear sampler created in PostInit and destroy it in
  DestroyInternal.
- Fix DestroyInternal() early-return leak: now tears down the instance
  even if device creation failed.

ctest passes 4/4.
This commit is contained in:
2026-07-13 10:19:30 +08:00
parent 55271a53c7
commit f1d19a03f8
2 changed files with 165 additions and 72 deletions
+1
View File
@@ -129,6 +129,7 @@ private:
VkInstance instance_ = VK_NULL_HANDLE;
VkPhysicalDevice physical_device_ = VK_NULL_HANDLE;
uint32_t physical_device_count_ = 0;
VkDevice device_ = VK_NULL_HANDLE;
VkQueue graphics_queue_ = VK_NULL_HANDLE;
uint32_t graphics_queue_family_ = UINT32_MAX;