Supported backends
- GHOST_SystemSDL
- GHOST_SystemWayland
- GHOST_SystemWin32
- GHOST_SystemX11
- GHOST_SystemCocoa: using vulkan metal wrapper.
Compile directive
There will be a new compile directive WITH_VULKAN_BACKEND this compile directive will enable adding vulkan context in ghost backend systems.
Creating a vulkan context
Vulkan contexts can be created by passing GHOST_kDrawingContextTypeVulkan when creating window/context.
Device selection
There can be multiple vulkan compatible devices inside a system. User should be able to select a device via the user preferences. When selecting a different device blender should be restarted by the user. When no specific device is selected a best matching device should be selected.
GHOST_VulkanDeviceListHandle* GHOST_GetVulkanAvailableDevices(GHOST_SystemHandle,...): returns a list of all devices that match requirements. When constructing a window/context a specific device should be given.
int64_t GHOST_VulkanDeviceListNumDevices(GHOST_VulkanDeviceListHandle* handle) will return the number of devices found
GHOST_Success GHOST_GetVulkanDeviceListItem(GHOST_VulkanDeviceListHandle* handle, int64_t index, GHOST_VulkanPhysicalDevice * r_device) will fill r_device with available data return the vendor and device id and a number to make the device unique.
GHOST_DestroyVulkanDeviceList should be called to free the GHOST_VulkanDeviceListHandle.
GHOST_VulkanPhysicalDevice is based on VkPhysicalDeviceProperties but has a additional attribute to make the Vendor+Device unique. the combination of those 3 fields will allow to select a unique device.
struct GHOST_VulkanPhysicalDeviceID {
uint32_t vendor_id;
uint32_t device_id;
int32_t index;
};
struct GHOST_VulkanPhysicalDevice {
GHOST_VulkanPhysicalDeviceID device_id;
VkPhysicalDeviceProperties device_properties;
};GHOST_GLSettings will get an GHOST_VulkanPhysicalDeviceID* attribute for device selection.
When NULL is passed for GHOST_VulkanPhysicalDeviceID or the passed device couldn't be found during context creation GHOST will automatically select the best available device based on the device type (discrete before integrated before virtual [before cpu?]).
Command queues
GHOST_GetVulkanBackbuffer(GHOST_WindowHandle will get the handles of the given window.
For offscreen rendering GHOST_GetVulkanHandles will retrieve the device handles and the command queue etc should be constructed by the caller.
Smaller tasks
- Remove references to OpenGL in the GHOST API that are not OpenGL specific.
- rename GHOST_CreateOpenGLContext to GHOST_CreateDrawingContext.
- rename GHOST_DisposeOpenGLContext to GHOST_DisposeDrawingContext.
- rename GHOST_ActivateOpenGLContext to GHOST_ActivateDrawingContext.
- rename GHOST_ReleaseOpenGLContext to GHOST_ReleaseDrawingContext.
- Unclear if we need to rename GHOST_GetDefaultOpenGLFramebuffer and GHOST_GetContextDefaultOpenGLFramebuffer or that we will have specific versions for Vulkan.