Flutter Windows Embedder
external_texture_d3d.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_D3D_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_D3D_H_
7 
8 #include <memory>
9 
10 #include "flutter/fml/macros.h"
15 
16 namespace flutter {
17 
18 // An external texture that is backed by a DXGI surface.
20  public:
24  void* user_data,
25  const egl::Manager* egl_manager,
26  std::shared_ptr<egl::ProcTable> gl);
27  virtual ~ExternalTextureD3d();
28 
29  // |ExternalTexture|
30  bool PopulateTexture(size_t width,
31  size_t height,
32  FlutterOpenGLTexture* opengl_texture) override;
33 
34  private:
35  // Creates or updates the backing texture and associates it with the provided
36  // surface.
37  bool CreateOrUpdateTexture(
38  const FlutterDesktopGpuSurfaceDescriptor* descriptor);
39  // Detaches the previously attached surface, if any.
40  void ReleaseImage();
41 
43  const FlutterDesktopGpuSurfaceTextureCallback texture_callback_;
44  void* const user_data_;
45  const egl::Manager* egl_manager_;
46  std::shared_ptr<egl::ProcTable> gl_;
47  GLuint gl_texture_ = 0;
48  EGLSurface egl_surface_ = EGL_NO_SURFACE;
49  void* last_surface_handle_ = nullptr;
50 
51  FML_DISALLOW_COPY_AND_ASSIGN(ExternalTextureD3d);
52 };
53 
54 } // namespace flutter
55 
56 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_EXTERNAL_TEXTURE_D3D_H_
flutter::ExternalTextureD3d::ExternalTextureD3d
ExternalTextureD3d(FlutterDesktopGpuSurfaceType type, const FlutterDesktopGpuSurfaceTextureCallback texture_callback, void *user_data, const egl::Manager *egl_manager, std::shared_ptr< egl::ProcTable > gl)
Definition: external_texture_d3d.cc:12
flutter::ExternalTextureD3d
Definition: external_texture_d3d.h:19
user_data
void * user_data
Definition: flutter_windows_view_unittests.cc:52
type
enum flutter::testing::@87::KeyboardChange::Type type
FlutterDesktopGpuSurfaceType
FlutterDesktopGpuSurfaceType
Definition: flutter_texture_registrar.h:32
external_texture.h
proc_table.h
flutter
Definition: accessibility_bridge_windows.cc:11
FlutterDesktopGpuSurfaceDescriptor
Definition: flutter_texture_registrar.h:70
flutter::egl::Manager
Definition: manager.h:31
flutter_texture_registrar.h
flutter::ExternalTextureD3d::~ExternalTextureD3d
virtual ~ExternalTextureD3d()
Definition: external_texture_d3d.cc:24
manager.h
flutter::ExternalTextureD3d::PopulateTexture
bool PopulateTexture(size_t width, size_t height, FlutterOpenGLTexture *opengl_texture) override
Definition: external_texture_d3d.cc:32
FlutterDesktopGpuSurfaceTextureCallback
const typedef FlutterDesktopGpuSurfaceDescriptor *(* FlutterDesktopGpuSurfaceTextureCallback)(size_t width, size_t height, void *user_data)
Definition: flutter_texture_registrar.h:125
flutter::ExternalTexture
Definition: external_texture.h:16
texture_callback
FlutterDesktopPixelBufferTextureCallback texture_callback
Definition: texture_registrar_unittests.cc:26