Flutter Engine
The Flutter Engine
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"
11#include "flutter/shell/platform/common/public/flutter_texture_registrar.h"
12#include "flutter/shell/platform/windows/egl/manager.h"
13#include "flutter/shell/platform/windows/egl/proc_table.h"
14#include "flutter/shell/platform/windows/external_texture.h"
15
16namespace 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_
GLenum type
bool PopulateTexture(size_t width, size_t height, FlutterOpenGLTexture *opengl_texture) override
ExternalTextureD3d(FlutterDesktopGpuSurfaceType type, const FlutterDesktopGpuSurfaceTextureCallback texture_callback, void *user_data, const egl::Manager *egl_manager, std::shared_ptr< egl::ProcTable > gl)
const FlutterDesktopGpuSurfaceDescriptor *(* FlutterDesktopGpuSurfaceTextureCallback)(size_t width, size_t height, void *user_data)
FlutterDesktopGpuSurfaceType
gl
Definition: malisc.py:41
int32_t height
int32_t width
void * user_data
FlutterDesktopPixelBufferTextureCallback texture_callback