Maniphest T93031

GHOST Vulkan Backend API.
Confirmed, NormalDESIGN

Assigned To
Jeroen Bakker (jbakker)
Authored By
Jeroen Bakker (jbakker)
Nov 12 2021, 9:20 AM
Tags
  • EEVEE & Viewport
Subscribers
Emi Martinez (EmiMartinez)
Erik Sanabria (ersb2194)
Jeroen Bakker (jbakker)
Kazashi Yoshioka (AgAmemnno)
Lain (Aboba)
Paul Larson (GeorgiaPacific)
Tokens
"Like" token, awarded by EmiMartinez.

Description

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?]).

NOTE: The VkQueryAPI requires an VkInstance. So we can only do this on an initialized GHOST_Context We could use a offscreen context for this.

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.

Revisions and Commits

rB Blender
D13155

Related Objects

StatusSubtypeAssignedTask
ConfirmedTO DOJeroen Bakker (jbakker)
ConfirmedDESIGNJeroen Bakker (jbakker)

Event Timeline

Jeroen Bakker (jbakker) changed the task status from Needs Triage to Confirmed.Nov 12 2021, 9:20 AM
Jeroen Bakker (jbakker) created this task.
Jeroen Bakker (jbakker) changed the subtype of this task from "Report" to "Design".
Jeroen Bakker (jbakker) added a revision: D13155: GHOST: Vulkan Backend..
Jeroen Bakker (jbakker) updated the task description.Nov 12 2021, 9:45 AM
Jeroen Bakker (jbakker) updated the task description.Nov 12 2021, 10:40 AM
Jeroen Bakker (jbakker) updated the task description.Nov 12 2021, 10:49 AM
Jeroen Bakker (jbakker) updated the task description.
Jeroen Bakker (jbakker) updated the task description.Nov 12 2021, 10:54 AM
Paul Larson (GeorgiaPacific) added a subscriber: Paul Larson (GeorgiaPacific).Nov 13 2021, 12:23 AM
Jeroen Bakker (jbakker) updated the task description.Nov 23 2021, 3:18 PM
Lain (Aboba) added a subscriber: Lain (Aboba).Dec 21 2021, 8:27 PM
Jeroen Bakker (jbakker) removed Jeroen Bakker (jbakker) as the assignee of this task.Feb 14 2022, 3:34 PM
Jeroen Bakker (jbakker) added a parent task: T68990: Vulkan support.Oct 19 2022, 3:19 PM
Jeroen Bakker (jbakker) mentioned this in T68990: Vulkan support.
Jeroen Bakker (jbakker) updated the task description.Oct 19 2022, 3:51 PM
Emi Martinez (EmiMartinez) added a subscriber: Emi Martinez (EmiMartinez).Oct 19 2022, 4:13 PM
Kazashi Yoshioka (AgAmemnno) added a subscriber: Kazashi Yoshioka (AgAmemnno).Oct 26 2022, 7:42 AM
Erik Sanabria (ersb2194) added a subscriber: Erik Sanabria (ersb2194).Nov 2 2022, 12:42 AM
Jeroen Bakker (jbakker) added a commit: rB6dac345a64b1: GHOST: Vulkan Backend..Nov 22 2022, 11:30 AM
Jeroen Bakker (jbakker) claimed this task.Nov 25 2022, 10:34 AM
Emi Martinez (EmiMartinez) awarded a token.Dec 15 2022, 4:29 PM