private static (GraphicsDevice gd, Swapchain sc) CreateDeviceAndSwapchain( Sdl2Window window, VRContext vrc, GraphicsBackend backend, GraphicsDeviceOptions gdo) { if (backend == GraphicsBackend.Vulkan) { (string[] instance, string[] device) = vrc.GetRequiredVulkanExtensions(); var vdo = new VulkanDeviceOptions(instance, device); var gd = GraphicsDevice.CreateVulkan(gdo, vdo); var swd = new SwapchainDescription( VeldridStartup.GetSwapchainSource(window), (uint)window.Width, (uint)window.Height, gdo.SwapchainDepthFormat, gdo.SyncToVerticalBlank, true); var sc = gd.ResourceFactory.CreateSwapchain(swd); return(gd, sc); } else { var gd = VeldridStartup.CreateGraphicsDevice(window, gdo, backend); var sc = gd.MainSwapchain; return(gd, sc); } }
public static unsafe GraphicsDevice CreateVulkanGraphicsDevice( GraphicsDeviceOptions options, Sdl2Window window, bool colorSrgb) { SwapchainDescription scDesc = new SwapchainDescription( GetSwapchainSource(window), (uint)window.Width, (uint)window.Height, options.SwapchainDepthFormat, options.SyncToVerticalBlank, colorSrgb); VulkanDeviceOptions vkopts = new VulkanDeviceOptions(); vkopts.InstanceExtensions = new string[] { "VK_KHR_get_physical_device_properties2" }; vkopts.DeviceExtensions = new string[] { "VK_KHR_maintenance3", "VK_EXT_descriptor_indexing" }; GraphicsDevice gd = GraphicsDevice.CreateVulkan(options, scDesc, vkopts); return(gd); }