| Flutter Windows Embedder |

gl_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
5 #include "flutter/shell/platform/windows/gl_proc_table.h"
6
7 #include <EGL/egl.h>
8
9 namespace flutter {
10
11 std::shared_ptr<GlProcTable> GlProcTable::Create() {
12 auto gl = std::shared_ptr<GlProcTable>(new GlProcTable());
13
14 gl->gen_textures_ =
15 reinterpret_cast<GenTexturesProc>(::eglGetProcAddress("glGenTextures"));
16 gl->delete_textures_ = reinterpret_cast<DeleteTexturesProc>(
17 ::eglGetProcAddress("glDeleteTextures"));
18 gl->bind_texture_ =
19 reinterpret_cast<BindTextureProc>(::eglGetProcAddress("glBindTexture"));
20 gl->tex_parameteri_ = reinterpret_cast<TexParameteriProc>(
21 ::eglGetProcAddress("glTexParameteri"));
22 gl->tex_image_2d_ =
23 reinterpret_cast<TexImage2DProc>(::eglGetProcAddress("glTexImage2D"));
24
25 if (!gl->gen_textures_ || !gl->delete_textures_ || !gl->bind_texture_ ||
26 !gl->tex_parameteri_ || !gl->tex_image_2d_) {
27 return nullptr;
28 }
29
30 return gl;
31 }
32
33 GlProcTable::GlProcTable() = default;
34
35 GlProcTable::~GlProcTable() = default;
36
37 void GlProcTable::GenTextures(GLsizei n, GLuint* textures) const {
38 gen_textures_(n, textures);
39 }
40
41 void GlProcTable::DeleteTextures(GLsizei n, const GLuint* textures) const {
42 delete_textures_(n, textures);
43 }
44
45 void GlProcTable::BindTexture(GLenum target, GLuint texture) const {
46 bind_texture_(target, texture);
47 }
48
49 void GlProcTable::TexParameteri(GLenum target,
50 GLenum pname,
51 GLint param) const {
52 tex_parameteri_(target, pname, param);
53 }
54
55 void GlProcTable::TexImage2D(GLenum target,
56 GLint level,
57 GLint internalformat,
58 GLsizei width,
59 GLsizei height,
60 GLint border,
61 GLenum format,
62 GLenum type,
63 const void* data) const {
64 tex_image_2d_(target, level, internalformat, width, height, border, format,
65 type, data);
66 }
67
68 } // namespace flutter
flutter::GlProcTable::GenTextures
virtual void GenTextures(GLsizei n, GLuint *textures) const
Definition: gl_proc_table.cc:37
flutter::GlProcTable::DeleteTextures
virtual void DeleteTextures(GLsizei n, const GLuint *textures) const
Definition: gl_proc_table.cc:41
gl_proc_table.h
flutter::GlProcTable::GlProcTable
GlProcTable()
flutter::GlProcTable::TexParameteri
virtual void TexParameteri(GLenum target, GLenum pname, GLint param) const
Definition: gl_proc_table.cc:49
flutter::GlProcTable::~GlProcTable
virtual ~GlProcTable()
type
enum flutter::testing::@69::KeyboardChange::Type type
flutter
Definition: accessibility_bridge_windows.cc:11
flutter::GlProcTable::Create
static std::shared_ptr< GlProcTable > Create()
Definition: gl_proc_table.cc:11
flutter::GlProcTable::BindTexture
virtual void BindTexture(GLenum target, GLuint texture) const
Definition: gl_proc_table.cc:45
flutter::GlProcTable::TexImage2D
virtual void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *data) const
Definition: gl_proc_table.cc:55