Flutter Engine
 
Loading...
Searching...
No Matches
proc_table.cc
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
6
7#include <EGL/egl.h>
8
9namespace flutter {
10namespace egl {
11
12std::shared_ptr<ProcTable> ProcTable::Create() {
13 auto gl = std::shared_ptr<ProcTable>(new ProcTable());
14
15 gl->gen_textures_ =
16 reinterpret_cast<GenTexturesProc>(::eglGetProcAddress("glGenTextures"));
17 gl->delete_textures_ = reinterpret_cast<DeleteTexturesProc>(
18 ::eglGetProcAddress("glDeleteTextures"));
19 gl->bind_texture_ =
20 reinterpret_cast<BindTextureProc>(::eglGetProcAddress("glBindTexture"));
21 gl->tex_parameteri_ = reinterpret_cast<TexParameteriProc>(
22 ::eglGetProcAddress("glTexParameteri"));
23 gl->tex_image_2d_ =
24 reinterpret_cast<TexImage2DProc>(::eglGetProcAddress("glTexImage2D"));
25
26 if (!gl->gen_textures_ || !gl->delete_textures_ || !gl->bind_texture_ ||
27 !gl->tex_parameteri_ || !gl->tex_image_2d_) {
28 return nullptr;
29 }
30
31 return gl;
32}
33
34ProcTable::ProcTable() = default;
35
36ProcTable::~ProcTable() = default;
37
38void ProcTable::GenTextures(GLsizei n, GLuint* textures) const {
39 gen_textures_(n, textures);
40}
41
42void ProcTable::DeleteTextures(GLsizei n, const GLuint* textures) const {
43 delete_textures_(n, textures);
44}
45
46void ProcTable::BindTexture(GLenum target, GLuint texture) const {
47 bind_texture_(target, texture);
48}
49
50void ProcTable::TexParameteri(GLenum target, GLenum pname, GLint param) const {
51 tex_parameteri_(target, pname, param);
52}
53
54void ProcTable::TexImage2D(GLenum target,
55 GLint level,
56 GLint internalformat,
57 GLsizei width,
58 GLsizei height,
59 GLint border,
60 GLenum format,
61 GLenum type,
62 const void* data) const {
63 tex_image_2d_(target, level, internalformat, width, height, border, format,
64 type, data);
65}
66
67} // namespace egl
68} // namespace flutter
GLenum type
uint32_t uint32_t * format
uint32_t * target
FlTexture * texture
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switch_defs.h:36
int32_t height
int32_t width
std::shared_ptr< const fml::Mapping > data