@@ -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,80 @@ 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+ /// Embedder provided unique identifier to the image. Given that the `image`
561+ /// handle is passed to the engine to render to, the image is itself owned by
562+ /// the embedder. This `image_id` is then also given to the embedder in the
563+ /// present callback.
564+ int64_t image_id ;
565+ /// Handle to the VkImage that is owned by the embedder. The engine will
566+ /// bind this image for writing the frame.
567+ FlutterVulkanImageHandle image ;
568+ /// A baton that is not interpreted by the engine in any way. It will be given
569+ /// back to the embedder in the destruction callback below. Embedder resources
570+ /// may be associated with this baton.
558571 void * user_data ;
572+ /// The callback invoked by the engine when it no longer needs this backing
573+ /// store.
574+ VoidCallback destruction_callback ;
575+ } FlutterVulkanImage ;
559576
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 ;
577+ /// Callback to fetch a Vulkan function pointer for a given instance. Normally,
578+ /// this should return the results of vkGetInstanceProcAddr.
579+ typedef void * ( * FlutterVulkanInstanceProcAddressCallback )(
580+ void * /* user data */ ,
581+ FlutterVulkanInstanceHandle /* instance */ ,
582+ const char * /* name */ ) ;
566583
567- FlutterVulkanGetNextImageCallback acquire_next_image_callback ;
568- VoidCallback terminate_callback ;
584+ /// Callback for when a VkImage is requested.
585+ typedef FlutterVulkanImage (* FlutterVulkanImageCallback )(
586+ void * /* user data */ ,
587+ const FlutterFrameInfo * /* frame info */ );
588+
589+ /// Callback for when a VkImage has been written to and is ready for use by the
590+ /// embedder. The `image_id` here corresponds to the image_id provided by the
591+ /// embedder in the `FlutterVulkanImageCallback` callback.
592+ typedef bool (* FlutterVulkanPresentCallback )(
593+ void * /* user data */ ,
594+ const FlutterVulkanImage * /* image */ );
595+ typedef uint64_t * (* Uint64Callback )(void * /* user data */ );
596+
597+ typedef uint64_t * (* FlutterVulkanPresentImageCallback )(void * /* user data */ ,
598+ uint64_t * /* image */ );
599+
600+ typedef struct {
601+ /// The size of this struct. Must be sizeof(FlutterVulkanRendererConfig).
602+ size_t struct_size ;
603+ // VkInstance handle.
604+ FlutterVulkanInstanceHandle instance ;
605+ // VkPhysicalDevice handle.
606+ FlutterVulkanPhysicalDeviceHandle physical_device ;
607+ // VkDevice handle.
608+ FlutterVulkanDeviceHandle device ;
609+ ProcResolver get_proc_address_callback ;
610+ FlutterVulkanInstanceProcAddressCallback get_instance_proc_address_callback ;
611+ /// The callback invoked when the engine requests a VkImage from the embedder
612+ /// for rendering the next frame.
613+ FlutterVulkanImageCallback get_next_image_callback ;
614+ /// The callback invoked when a VkImage has been written to and is ready for
615+ /// use by the embedder. Prior to calling this callback, the engine performs
616+ /// a host sync, and so the VkImage can be used in a pipeline by the embedder
617+ /// without any additional synchronization.
618+ FlutterVulkanPresentCallback present_image_callback ;
569619
570620} FlutterVulkanRendererConfig ;
571621
@@ -1022,11 +1072,13 @@ typedef struct {
10221072 /// The size of this struct. Must be sizeof(FlutterVulkanBackingStore).
10231073 size_t struct_size ;
10241074
1025- /// VkImage handle.
1026- uint64_t handle ;
1027-
1028- /// VkSemaphore signaled when engine is done writing image.
1029- uint64_t image_ready ;
1075+ /// The Vulkan image that the layer will be rendered to. This image must
1076+ /// already be available for the engine to bind for writing when it's given to
1077+ /// the engine via the backing store creation callback. The engine will
1078+ /// perform a host sync for all layers prior to calling the compositor present
1079+ /// callback, and so the written layer images can be freely bound by the
1080+ /// embedder without any additional synchronization.
1081+ FlutterVulkanImage image ;
10301082} FlutterVulkanBackingStore ;
10311083
10321084typedef enum {
0 commit comments