@@ -23,9 +23,31 @@ typedef struct FlutterDesktopTextureRegistrar*
2323// Additional types may be added in the future.
2424typedef enum {
2525 // A Pixel buffer-based texture.
26- kFlutterDesktopPixelBufferTexture
26+ kFlutterDesktopPixelBufferTexture ,
27+ // A platform-specific GPU surface-backed texture.
28+ kFlutterDesktopGpuSurfaceTexture
2729} FlutterDesktopTextureType ;
2830
31+ // Supported GPU surface types.
32+ typedef enum {
33+ // Uninitialized.
34+ kFlutterDesktopGpuSurfaceTypeNone ,
35+ // A D3D/DXGI-based surface.
36+ kFlutterDesktopGpuSurfaceTypeDxgi
37+ } FlutterDesktopGpuSurfaceType ;
38+
39+ // Supported pixel formats.
40+ typedef enum {
41+ // Uninitialized.
42+ kFlutterDesktopPixelFormatNone ,
43+ // Represents a 32-bit RGBA color format with 8 bits each for red, green, blue
44+ // and alpha.
45+ kFlutterDesktopPixelFormatRGBA8888 ,
46+ // Represents a 32-bit BGRA color format with 8 bits each for blue, green, red
47+ // and alpha.
48+ kFlutterDesktopPixelFormatBGRA8888
49+ } FlutterDesktopPixelFormat ;
50+
2951// An image buffer object.
3052typedef struct {
3153 // The pixel data buffer.
@@ -40,6 +62,26 @@ typedef struct {
4062 void * release_context ;
4163} FlutterDesktopPixelBuffer ;
4264
65+ // A GPU surface descriptor.
66+ typedef struct {
67+ // The surface handle.
68+ // For DirectX textures (kFlutterDesktopGpuSurfaceTypeDxgi), this is the
69+ // shared handle of an IDXGIResource.
70+ void * handle ;
71+ // The physical width.
72+ size_t width ;
73+ // The physical height.
74+ size_t height ;
75+ // The visible width.
76+ // It might be less or equal to the physical |width|.
77+ size_t visible_width ;
78+ // The visible height.
79+ // It might be less or equal to the physical |height|.
80+ size_t visible_height ;
81+ // The pixel format which might by optional depending on the surface type.
82+ FlutterDesktopPixelFormat format ;
83+ } FlutterDesktopGpuSurfaceDescriptor ;
84+
4385// The pixel buffer copy callback definition provided to
4486// the Flutter engine to copy the texture.
4587// It is invoked with the intended surface size specified by |width| and
@@ -54,6 +96,11 @@ typedef const FlutterDesktopPixelBuffer* (
5496 size_t height ,
5597 void * user_data );
5698
99+ typedef const FlutterDesktopGpuSurfaceDescriptor * (
100+ * FlutterDesktopGpuSurfaceTextureCallback )(size_t width ,
101+ size_t height ,
102+ void * user_data );
103+
57104// An object used to configure pixel buffer textures.
58105typedef struct {
59106 // The callback used by the engine to copy the pixel buffer object.
@@ -62,10 +109,21 @@ typedef struct {
62109 void * user_data ;
63110} FlutterDesktopPixelBufferTextureConfig ;
64111
112+ // An object used to configure GPU-surface textures.
113+ typedef struct {
114+ // The concrete surface type (e.g. kFlutterDesktopGpuSurfaceTypeDxgi)
115+ FlutterDesktopGpuSurfaceType type ;
116+ // The callback used by the engine to obtain the surface descriptor.
117+ FlutterDesktopGpuSurfaceTextureCallback callback ;
118+ // Opaque data that will get passed to the provided |callback|.
119+ void * user_data ;
120+ } FlutterDesktopGpuSurfaceTextureConfig ;
121+
65122typedef struct {
66123 FlutterDesktopTextureType type ;
67124 union {
68125 FlutterDesktopPixelBufferTextureConfig pixel_buffer_config ;
126+ FlutterDesktopGpuSurfaceTextureConfig gpu_surface_config ;
69127 };
70128} FlutterDesktopTextureInfo ;
71129
0 commit comments