@@ -495,7 +495,7 @@ typedef struct {
495495 size_t struct_size ;
496496 /// Embedder provided unique identifier to the texture buffer. Given that the
497497 /// `texture` handle is passed to the engine to render to, the texture buffer
498- /// is itseld owned by the embedder. This `texture_id` is then also given to
498+ /// is itself owned by the embedder. This `texture_id` is then also given to
499499 /// the embedder in the present callback.
500500 int64_t texture_id ;
501501 /// Handle to the MTLTexture that is owned by the embedder. Engine will render
@@ -542,30 +542,74 @@ typedef struct {
542542 FlutterMetalTextureFrameCallback external_texture_frame_callback ;
543543} FlutterMetalRendererConfig ;
544544
545- typedef uintptr_t * (* FlutterVulkanGetNextImageCallback )(void * /* user data */ );
545+ /// Alias for VkInstance.
546+ typedef const uint64_t * FlutterVulkanInstanceHandle ;
546547
547- typedef void * (* ProcAddressCallback )(void * user /* in */ ,
548- const char * pName /* in */ );
549- typedef void * (* InstanceProcAddressCallback )(void * user /* in */ ,
550- uintptr_t * instance /* in */ ,
551- const char * pName /* in */ );
552- typedef uintptr_t * (* UintPtrCallback )(void * user /* in */ );
548+ /// Alias for VkPhysicalDevice.
549+ typedef const uint64_t * FlutterVulkanPhysicalDeviceHandle ;
550+
551+ /// Alias for VkDevice.
552+ typedef const uint64_t * FlutterVulkanDeviceHandle ;
553+
554+ /// Alias for VkImage.
555+ typedef const uint64_t * FlutterVulkanImageHandle ;
553556
554557typedef struct {
555- /// The size of this struct. Must be sizeof(FlutterVulkanRendererConfig ).
558+ /// The size of this struct. Must be sizeof(FlutterVulkanImage ).
556559 size_t struct_size ;
557-
560+ /// Handle to the VkImage that is owned by the embedder. The engine will
561+ /// bind this image for writing the frame.
562+ FlutterVulkanImageHandle image ;
563+ /// A baton that is not interpreted by the engine in any way. It will be given
564+ /// back to the embedder in the destruction callback below. Embedder resources
565+ /// may be associated with this baton.
558566 void * user_data ;
567+ /// The callback invoked by the engine when it no longer needs this backing
568+ /// store.
569+ VoidCallback destruction_callback ;
570+ } FlutterVulkanImage ;
559571
560- /// Platform Callbacks
561- ProcAddressCallback get_proc_address_callback ;
562- InstanceProcAddressCallback get_instance_proc_address_callback ;
563- UintPtrCallback get_instance_handle_callback ;
564- UintPtrCallback get_physical_device_handle_callback ;
565- UintPtrCallback get_device_handle_callback ;
572+ /// Callback to fetch a Vulkan function pointer for a given instance. Normally,
573+ /// this should return the results of vkGetInstanceProcAddr.
574+ typedef void * ( * FlutterVulkanInstanceProcAddressCallback )(
575+ void * /* user data */ ,
576+ FlutterVulkanInstanceHandle /* instance */ ,
577+ const char * /* name */ ) ;
566578
567- FlutterVulkanGetNextImageCallback acquire_next_image_callback ;
568- VoidCallback terminate_callback ;
579+ /// Callback for when a VkImage is requested.
580+ typedef FlutterVulkanImage (* FlutterVulkanImageCallback )(
581+ void * /* user data */ ,
582+ const FlutterFrameInfo * /* frame info */ );
583+
584+ /// Callback for when a VkImage has been written to and is ready for use by the
585+ /// embedder.
586+ typedef bool (* FlutterVulkanPresentCallback )(
587+ void * /* user data */ ,
588+ const FlutterVulkanImage * /* image */ );
589+ typedef uint64_t * (* Uint64Callback )(void * /* user data */ );
590+
591+ typedef uint64_t * (* FlutterVulkanPresentImageCallback )(void * /* user data */ ,
592+ uint64_t * /* image */ );
593+
594+ typedef struct {
595+ /// The size of this struct. Must be sizeof(FlutterVulkanRendererConfig).
596+ size_t struct_size ;
597+ // VkInstance handle.
598+ FlutterVulkanInstanceHandle instance ;
599+ // VkPhysicalDevice handle.
600+ FlutterVulkanPhysicalDeviceHandle physical_device ;
601+ // VkDevice handle.
602+ FlutterVulkanDeviceHandle device ;
603+ ProcResolver get_proc_address_callback ;
604+ FlutterVulkanInstanceProcAddressCallback get_instance_proc_address_callback ;
605+ /// The callback invoked when the engine requests a VkImage from the embedder
606+ /// for rendering the next frame.
607+ FlutterVulkanImageCallback get_next_image_callback ;
608+ /// The callback invoked when a VkImage has been written to and is ready for
609+ /// use by the embedder. Prior to calling this callback, the engine performs
610+ /// a host sync, and so the VkImage can be used in a pipeline by the embedder
611+ /// without any additional synchronization.
612+ FlutterVulkanPresentCallback present_image_callback ;
569613
570614} FlutterVulkanRendererConfig ;
571615
@@ -1022,11 +1066,13 @@ typedef struct {
10221066 /// The size of this struct. Must be sizeof(FlutterVulkanBackingStore).
10231067 size_t struct_size ;
10241068
1025- /// VkImage handle.
1026- uint64_t handle ;
1027-
1028- /// VkSemaphore signaled when engine is done writing image.
1029- uint64_t image_ready ;
1069+ /// The Vulkan image that the layer will be rendered to. This image must
1070+ /// already be available for the engine to bind for writing when it's given to
1071+ /// the engine via the backing store creation callback. The engine will
1072+ /// perform a host sync for all layers prior to calling the compositor present
1073+ /// callback, and so the written layer images can be freely bound by the
1074+ /// embedder without any additional synchronization.
1075+ FlutterVulkanImage image ;
10301076} FlutterVulkanBackingStore ;
10311077
10321078typedef enum {
0 commit comments