diff --git a/libretro-common/include/libretro_vulkan.h b/libretro-common/include/libretro_vulkan.h index b761e0afea..c7e2586e2d 100644 --- a/libretro-common/include/libretro_vulkan.h +++ b/libretro-common/include/libretro_vulkan.h @@ -27,6 +27,7 @@ #include #define RETRO_HW_RENDER_INTERFACE_VULKAN_VERSION 3 +#define RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN_VERSION 1 struct retro_vulkan_image { @@ -50,6 +51,24 @@ typedef void (*retro_vulkan_wait_sync_index_t)(void *handle); typedef void (*retro_vulkan_lock_queue_t)(void *handle); typedef void (*retro_vulkan_unlock_queue_t)(void *handle); +struct retro_vulkan_context +{ + VkPhysicalDevice gpu; + VkDevice device; + VkQueue queue; + uint32_t queue_family_index; +}; + +typedef void *(*retro_vulkan_create_device_t)( + struct retro_vulkan_context *context, + VkInstance instance, + PFN_vkGetInstanceProcAddr get_proc_addr, + const char **required_device_extensions, + unsigned num_required_device_extensions, + const VkPhysicalDeviceFeatures *required_features); + +typedef void (*retro_vulkan_destroy_handle_t)(void *data); + /* Note on thread safety: * The Vulkan API is heavily designed around multi-threading, and * the libretro interface for it should also be threading friendly. @@ -57,6 +76,17 @@ typedef void (*retro_vulkan_unlock_queue_t)(void *handle); * command buffers to the GPU from any thread. */ +struct retro_hw_render_context_negotiation_interface_vulkan +{ + /* Must be set to RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN. */ + enum retro_hw_render_interface_type interface_type; + /* Must be set to RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN_VERSION. */ + unsigned interface_version; + + retro_vulkan_create_device_t create_device; + retro_vulkan_destroy_handle_t destroy_handle; +}; + struct retro_hw_render_interface_vulkan { /* Must be set to RETRO_HW_RENDER_INTERFACE_VULKAN. */ @@ -78,6 +108,11 @@ struct retro_hw_render_interface_vulkan */ void *handle; + /* An opaque handle that is used to pass data from context negotiation interface + * to the hardware interface. + */ + void *core_handle; + /* The Vulkan instance the context is using. */ VkInstance instance; /* The physical device used. */