Flutter Impeller
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 "
impeller/toolkit/glvk/proc_table.h
"
6
7
#include "
impeller/base/validation.h
"
8
9
namespace
impeller::glvk
{
10
11
ProcTable::ProcTable
(
const
Resolver
& resolver) {
12
if
(!resolver) {
13
return
;
14
}
15
16
auto
error_fn =
reinterpret_cast<
PFNGLGETERRORPROC
>
(resolver(
"glGetError"
));
17
if
(!error_fn) {
18
VALIDATION_LOG
<<
"Could not resolve "
<<
"glGetError"
;
19
return
;
20
}
21
22
#define GLVK_PROC(proc_ivar) \
23
if (auto fn_ptr = resolver(proc_ivar.name)) { \
24
proc_ivar.function = \
25
reinterpret_cast<decltype(proc_ivar.function)>(fn_ptr); \
26
proc_ivar.error_fn = error_fn; \
27
} else { \
28
VALIDATION_LOG << "Could not resolve " << proc_ivar.name; \
29
return; \
30
}
31
32
FOR_EACH_GLVK_PROC
(
GLVK_PROC
);
33
34
#undef GLVK_PROC
35
36
is_valid_ =
true
;
37
}
38
39
ProcTable::~ProcTable
() =
default
;
40
41
bool
ProcTable::IsValid
()
const
{
42
return
is_valid_;
43
}
44
45
}
// namespace impeller::glvk
impeller::glvk
Definition:
proc_table.cc:9
impeller::glvk::ProcTable::FOR_EACH_GLVK_PROC
FOR_EACH_GLVK_PROC(GLVK_PROC)
impeller::glvk::ProcTable::Resolver
std::function< void *(const char *function_name)> Resolver
Definition:
proc_table.h:63
impeller::glvk::ProcTable::ProcTable
ProcTable(const Resolver &resolver)
Create a proc table using a resolver to resolve OpenGL methods.
Definition:
proc_table.cc:11
validation.h
GLVK_PROC
#define GLVK_PROC(proc_ivar)
VALIDATION_LOG
#define VALIDATION_LOG
Definition:
validation.h:91
impeller::glvk::ProcTable::IsValid
bool IsValid() const
Determines if a proc. table is suitable for interop purposes. The absence of optional extension metho...
Definition:
proc_table.cc:41
impeller::glvk::ProcTable::~ProcTable
~ProcTable()
proc_table.h
impeller
toolkit
glvk
proc_table.cc
Generated by
1.8.17