Flutter Impeller
impeller::glvk::ProcTable Class Reference

A proc. table consisting of methods that are useful when interoperating between OpenGL and Vulkan. This is different from the OpenGL proc. table since it may contain more interop extension related methods. More...

#include <proc_table.h>

Public Types

using Resolver = std::function< void *(const char *function_name)>
 

Public Member Functions

 ProcTable (const Resolver &resolver)
 Create a proc table using a resolver to resolve OpenGL methods. More...
 
 ~ProcTable ()
 
 ProcTable (const ProcTable &)=delete
 
ProcTableoperator= (const ProcTable &)=delete
 
bool IsValid () const
 Determines if a proc. table is suitable for interop purposes. The absence of optional extension methods that have fallbacks don't result in an invalid proc. table. But an invalid proc table must always be discarded as there can be no error recovery. More...
 
 FOR_EACH_GLVK_PROC (GLVK_PROC)
 

Detailed Description

A proc. table consisting of methods that are useful when interoperating between OpenGL and Vulkan. This is different from the OpenGL proc. table since it may contain more interop extension related methods.

Definition at line 61 of file proc_table.h.

Member Typedef Documentation

◆ Resolver

using impeller::glvk::ProcTable::Resolver = std::function<void*(const char* function_name)>

Definition at line 63 of file proc_table.h.

Constructor & Destructor Documentation

◆ ProcTable() [1/2]

impeller::glvk::ProcTable::ProcTable ( const Resolver resolver)
explicit

Create a proc table using a resolver to resolve OpenGL methods.

Parameters
[in]resolverThe resolver

Definition at line 11 of file proc_table.cc.

11  {
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 
33 
34 #undef GLVK_PROC
35 
36  is_valid_ = true;
37 }
#define GLVK_PROC(proc_ivar)
#define VALIDATION_LOG
Definition: validation.h:91

References FOR_EACH_GLVK_PROC(), GLVK_PROC, and VALIDATION_LOG.

◆ ~ProcTable()

impeller::glvk::ProcTable::~ProcTable ( )
default

◆ ProcTable() [2/2]

impeller::glvk::ProcTable::ProcTable ( const ProcTable )
delete

Member Function Documentation

◆ FOR_EACH_GLVK_PROC()

impeller::glvk::ProcTable::FOR_EACH_GLVK_PROC ( GLVK_PROC  )

Referenced by ProcTable().

◆ IsValid()

bool impeller::glvk::ProcTable::IsValid ( ) const

Determines if a proc. table is suitable for interop purposes. The absence of optional extension methods that have fallbacks don't result in an invalid proc. table. But an invalid proc table must always be discarded as there can be no error recovery.

Returns
True if valid, False otherwise.

Definition at line 41 of file proc_table.cc.

41  {
42  return is_valid_;
43 }

◆ operator=()

ProcTable& impeller::glvk::ProcTable::operator= ( const ProcTable )
delete

The documentation for this class was generated from the following files: