OGLplus  (0.59.0) a C++ wrapper for rendering APIs

c_api.hpp
Go to the documentation of this file.
1 #ifndef EGLPLUS_EGL_API_C_API_HPP
9 #define EGLPLUS_EGL_API_C_API_HPP
10 
11 #include "api_traits.hpp"
12 #include "config.hpp"
13 #include <eagine/diagnostic.hpp>
14 #include <eagine/nothing.hpp>
15 #include <eagine/preprocessor.hpp>
16 
17 #ifndef EGLPLUS_EGL_STATIC_FUNC
18 #if EGLPLUS_HAS_EGL
19 #define EGLPLUS_EGL_STATIC_FUNC(NAME) &EAGINE_JOIN(::egl, NAME)
20 #else
21 #define EGLPLUS_EGL_STATIC_FUNC(NAME) nullptr
22 #endif
23 #endif
24 
25 namespace eagine::eglp {
26 //------------------------------------------------------------------------------
31 template <typename ApiTraits>
33 public:
34  using this_api = basic_egl_c_api;
35 
37  using api_traits = ApiTraits;
38 
39  static constexpr bool has_api = egl_types::has_api;
40 
43 
45  using time_type = typename egl_types::time_type;
46 
48  using sync_type = typename egl_types::sync_type;
49 
51  using enum_type = typename egl_types::enum_type;
52 
54  using bool_type = typename egl_types::bool_type;
55 
57  using char_type = typename egl_types::char_type;
58 
60  using int_type = typename egl_types::int_type;
61 
64 
67 
70 
73 
76 
79 
82 
85 
88 
91 
94 
97 
100 
103 
104 #ifdef __GNUC__
105  EAGINE_DIAG_PUSH()
106  EAGINE_DIAG_OFF(address)
107 #endif
108 
110  template <
111  typename Signature,
112  c_api_function_ptr<api_traits, nothing_t, Signature> Function>
114  api_traits,
115  nothing_t,
116  Signature,
117  Function,
118  has_api,
119  bool(Function)>;
120 
121 #ifdef __GNUC__
122  EAGINE_DIAG_POP()
123 #endif
124 
127  egl_api_function<int_type(), EGLPLUS_EGL_STATIC_FUNC(GetError)> GetError;
128 
132  void (*(const char_type*))(),
133  EGLPLUS_EGL_STATIC_FUNC(GetProcAddress)>
135 
140 
145 
150  EGLPLUS_EGL_STATIC_FUNC(GetPlatformDisplay)>
152 
157  EGLPLUS_EGL_STATIC_FUNC(GetDisplay)>
159 
162  egl_api_function<const char_type*(display_type), nullptr>
164 
169  EGLPLUS_EGL_STATIC_FUNC(Initialize)>
171 
174  egl_api_function<bool_type(display_type), EGLPLUS_EGL_STATIC_FUNC(Terminate)>
176 
181  EGLPLUS_EGL_STATIC_FUNC(QueryString)>
183 
188  EGLPLUS_EGL_STATIC_FUNC(GetConfigs)>
190 
195  EGLPLUS_EGL_STATIC_FUNC(ChooseConfig)>
197 
202  EGLPLUS_EGL_STATIC_FUNC(GetConfigAttrib)>
204 
209  EGLPLUS_EGL_STATIC_FUNC(CreatePlatformWindowSurface)>
211 
216  EGLPLUS_EGL_STATIC_FUNC(CreateWindowSurface)>
218 
223  EGLPLUS_EGL_STATIC_FUNC(CreatePbufferSurface)>
225 
230  EGLPLUS_EGL_STATIC_FUNC(CreatePlatformPixmapSurface)>
232 
237  EGLPLUS_EGL_STATIC_FUNC(CreatePixmapSurface)>
239 
244  nullptr>
246 
251  EGLPLUS_EGL_STATIC_FUNC(DestroySurface)>
253 
258  EGLPLUS_EGL_STATIC_FUNC(GetCurrentSurface)>
260 
265  EGLPLUS_EGL_STATIC_FUNC(SurfaceAttrib)>
267 
272  EGLPLUS_EGL_STATIC_FUNC(QuerySurface)>
274 
279 
284 
289  nullptr>
291 
296  nullptr>
298 
303 
308 
313 
317  bool_type(
318  display_type,
319  const attrib_type*,
321  int_type,
322  int_type*),
323  nullptr>
325 
330  nullptr>
332 
337  nullptr>
339 
344  nullptr>
346 
350  bool_type(
351  display_type,
352  const attrib_type*,
354  int_type,
355  int_type*),
356  nullptr>
358 
363  nullptr>
365 
370  nullptr>
372 
377  nullptr>
379 
384  EGLPLUS_EGL_STATIC_FUNC(BindTexImage)>
386 
391  EGLPLUS_EGL_STATIC_FUNC(ReleaseTexImage)>
393 
396  egl_api_function<bool_type(enum_type), EGLPLUS_EGL_STATIC_FUNC(BindAPI)>
398 
401  egl_api_function<enum_type(), EGLPLUS_EGL_STATIC_FUNC(QueryAPI)> QueryAPI;
402 
407  EGLPLUS_EGL_STATIC_FUNC(CreateContext)>
409 
414  EGLPLUS_EGL_STATIC_FUNC(DestroyContext)>
416 
421  EGLPLUS_EGL_STATIC_FUNC(MakeCurrent)>
423 
426  egl_api_function<context_type(), EGLPLUS_EGL_STATIC_FUNC(GetCurrentContext)>
428 
433  EGLPLUS_EGL_STATIC_FUNC(QueryContext)>
435 
438  egl_api_function<bool_type(), EGLPLUS_EGL_STATIC_FUNC(WaitClient)>
440 
443  egl_api_function<bool_type(int_type), EGLPLUS_EGL_STATIC_FUNC(WaitNative)>
445 
450  EGLPLUS_EGL_STATIC_FUNC(CreateSync)>
452 
457  EGLPLUS_EGL_STATIC_FUNC(ClientWaitSync)>
459 
464  EGLPLUS_EGL_STATIC_FUNC(WaitSync)>
466 
471  EGLPLUS_EGL_STATIC_FUNC(GetSyncAttrib)>
473 
478  EGLPLUS_EGL_STATIC_FUNC(DestroySync)>
480 
484  image_type(
485  display_type,
486  context_type,
487  enum_type,
489  const attrib_type*),
490  EGLPLUS_EGL_STATIC_FUNC(CreateImage)>
492 
497  EGLPLUS_EGL_STATIC_FUNC(DestroyImage)>
499 
504  EGLPLUS_EGL_STATIC_FUNC(CopyBuffers)>
506 
511  EGLPLUS_EGL_STATIC_FUNC(SwapInterval)>
513 
518  EGLPLUS_EGL_STATIC_FUNC(SwapBuffers)>
520 
525  nullptr>
527 
530  egl_api_function<bool_type(), EGLPLUS_EGL_STATIC_FUNC(ReleaseThread)>
532 
533  basic_egl_c_api(api_traits& traits);
534 };
535 //------------------------------------------------------------------------------
539 //------------------------------------------------------------------------------
540 } // namespace eagine::eglp
541 
542 #endif // EGLPLUS_EGL_API_C_API_HPP
egl_api_function< bool_type(display_type, output_layer_type, int_type, attrib_type *), nullptr > QueryOutputLayerAttrib
Definition: c_api.hpp:338
typename egl_types::client_buffer_type client_buffer_type
Alias for client buffer handle type.
Definition: c_api.hpp:75
EGLSync sync_type
Sync object handle type.
Definition: config.hpp:104
egl_api_function< bool_type(display_type, stream_type), nullptr > StreamConsumerAcquire
Definition: c_api.hpp:307
typename egl_types::enum_type enum_type
Alias for enumeration type.
Definition: c_api.hpp:51
egl_api_function< bool_type(display_type, output_layer_type, int_type, attrib_type), nullptr > OutputLayerAttrib
Definition: c_api.hpp:331
egl_api_function< bool_type(display_type, sync_type), nullptr > DestroySync
Definition: c_api.hpp:479
egl_api_function< enum_type(), nullptr > QueryAPI
Definition: c_api.hpp:401
char char_type
String character type.
Definition: config.hpp:57
EGL-related code is placed in this namespace.
Definition: eglplus.hpp:11
std::conditional_t< IsAvailable, std::conditional_t< IsStatic, static_c_api_function< ApiTraits, Tag, Signature, function >, dynamic_c_api_function< ApiTraits, Tag, Signature > >, unimplemented_c_api_function< ApiTraits, Tag, Signature > > opt_c_api_function
Template alias used for switching between static and dynamic function.
Definition: c_api_wrap.hpp:1096
egl_api_function< bool_type(display_type, stream_type, int_type, int_type *), nullptr > QueryStream
Definition: c_api.hpp:297
void * output_layer_type
Output layer handle type.
Definition: config.hpp:66
egl_api_function< bool_type(display_type, surface_type, int_type, int_type), nullptr > SurfaceAttrib
Definition: c_api.hpp:266
Class representing "none" / "nothing" values.
Definition: nothing.hpp:17
egl_api_function< int_type(), nullptr > GetError
Definition: c_api.hpp:127
egl_api_function< const char_type *(display_type, int_type), nullptr > QueryString
Definition: c_api.hpp:182
egl_api_function< bool_type(display_type, surface_type, const int_type *, int_type), nullptr > SwapBuffersWithDamage
Definition: c_api.hpp:526
egl_api_function< display_type(enum_type, void_ptr_type, const attrib_type *), nullptr > GetPlatformDisplay
Definition: c_api.hpp:151
egl_api_function< bool_type(display_type, int_type *, int_type *), nullptr > Initialize
Definition: c_api.hpp:170
egl_api_function< context_type(display_type, config_type, context_type, const int_type *), nullptr > CreateContext
Definition: c_api.hpp:408
EGLConfig config_type
Config handle type.
Definition: config.hpp:89
EGLNativePixmapType native_pixmap_type
Native pixmap handle type.
Definition: config.hpp:80
egl_api_function< bool_type(display_type, stream_type, int_type, int_type), nullptr > StreamAttrib
Definition: c_api.hpp:290
egl_api_function< bool_type(display_type, sync_type, int_type, attrib_type *), nullptr > GetSyncAttrib
Definition: c_api.hpp:472
egl_api_function< bool_type(display_type, const attrib_type *, output_port_type *, int_type, int_type *), nullptr > GetOutputPorts
Definition: c_api.hpp:357
EGLNativeDisplayType native_display_type
Native display handle type.
Definition: config.hpp:74
egl_api_function< bool_type(display_type, context_type), nullptr > DestroyContext
Definition: c_api.hpp:415
typename egl_types::config_type config_type
Alias for config handle type.
Definition: c_api.hpp:84
typename egl_types::bool_type bool_type
Alias for boolean type.
Definition: c_api.hpp:54
egl_api_function< surface_type(display_type, config_type, native_window_type, const int_type *), nullptr > CreateWindowSurface
Definition: c_api.hpp:217
EGLNativeWindowType native_window_type
Native window handle type.
Definition: config.hpp:77
egl_api_function< bool_type(), nullptr > WaitClient
Definition: c_api.hpp:439
typename egl_types::native_pixmap_type native_pixmap_type
Alias for native pixmap handle type.
Definition: c_api.hpp:72
egl_api_function< bool_type(display_type, surface_type), nullptr > SwapBuffers
Definition: c_api.hpp:519
egl_api_function< bool_type(display_type, const int_type *, config_type *, int_type, int_type *), nullptr > ChooseConfig
Definition: c_api.hpp:196
typename egl_types::sync_type sync_type
Alias for sync type.
Definition: c_api.hpp:48
egl_api_function< bool_type(display_type, stream_type), nullptr > StreamConsumerRelease
Definition: c_api.hpp:312
typename egl_types::output_layer_type output_layer_type
Alias for output layer handle type.
Definition: c_api.hpp:96
EGLenum enum_type
Enumeration type.
Definition: config.hpp:113
egl_api_function< bool_type(enum_type), nullptr > BindAPI
Definition: c_api.hpp:397
typename egl_types::surface_type surface_type
Alias for surface handle type.
Definition: c_api.hpp:81
void * output_port_type
Output port handle type.
Definition: config.hpp:69
void * void_ptr_type
Untyped non-const pointer type.
Definition: config.hpp:54
egl_api_function< const char_type *(display_type, output_layer_type, int_type), nullptr > QueryOutputLayerString
Definition: c_api.hpp:345
typename egl_types::char_type char_type
Alias for string character type.
Definition: c_api.hpp:57
basic_address< false > address
Type alias for non-const memory address values.
Definition: address.hpp:203
egl_api_function< bool_type(display_type, surface_type, int_type), nullptr > ReleaseTexImage
Definition: c_api.hpp:392
egl_api_function< bool_type(display_type, sync_type, int_type), nullptr > WaitSync
Definition: c_api.hpp:465
typename egl_types::int_type int_type
Alias for signed integer type.
Definition: c_api.hpp:60
Class wrapping the C-functions from the EGL API.
Definition: c_api.hpp:32
egl_api_function< bool_type(display_type, surface_type, int_type), nullptr > BindTexImage
Definition: c_api.hpp:385
egl_api_function< surface_type(display_type, config_type, native_pixmap_type, const int_type *), nullptr > CreatePixmapSurface
Definition: c_api.hpp:238
egl_api_function< bool_type(display_type, surface_type, int_type, int_type *), nullptr > QuerySurface
Definition: c_api.hpp:273
typename egl_types::attrib_type attrib_type
Alias for attribute type.
Definition: c_api.hpp:87
typename egl_types::time_type time_type
Alias for time duration type.
Definition: c_api.hpp:45
egl_api_function< bool_type(display_type, const attrib_type *, output_layer_type *, int_type, int_type *), nullptr > GetOutputLayers
Definition: c_api.hpp:324
egl_api_function< surface_type(display_type, config_type, void_ptr_type, const attrib_type *), nullptr > CreatePlatformPixmapSurface
Definition: c_api.hpp:231
egl_api_function< context_type(), nullptr > GetCurrentContext
Definition: c_api.hpp:427
typename egl_types::stream_type stream_type
Alias for stream handle type.
Definition: c_api.hpp:93
typename egl_types::native_display_type native_display_type
Alias for native display handle type.
Definition: c_api.hpp:66
eagine::opt_c_api_function< api_traits, nothing_t, Signature, Function, has_api, bool(Function)> egl_api_function
Alias for EGL C-API function wrapper template.
Definition: c_api.hpp:119
egl_api_function< bool_type(display_type, image_type), nullptr > DestroyImage
Definition: c_api.hpp:498
egl_api_function< const char_type *(device_type, int_type), nullptr > QueryDeviceString
Definition: c_api.hpp:144
typename egl_types::device_type device_type
Alias for device handle type.
Definition: c_api.hpp:63
EGLSurface surface_type
Rendering surface handle type.
Definition: config.hpp:98
egl_api_function< bool_type(display_type, surface_type), nullptr > DestroySurface
Definition: c_api.hpp:252
egl_api_function< bool_type(display_type, output_port_type, int_type, attrib_type), nullptr > OutputPortAttrib
Definition: c_api.hpp:364
void * device_type
Device handle type.
Definition: config.hpp:60
typename egl_types::output_port_type output_port_type
Alias for output port handle type.
Definition: c_api.hpp:99
egl_api_function< surface_type(display_type, const int_type *), nullptr > CreateStream
Definition: c_api.hpp:278
egl_api_function< surface_type(display_type, config_type, stream_type, const int_type *), nullptr > CreateStreamProducerSurface
Definition: c_api.hpp:245
egl_api_function< sync_type(display_type, enum_type, const attrib_type *), nullptr > CreateSync
Definition: c_api.hpp:451
EGLContext context_type
Rendering context handle type.
Definition: config.hpp:95
EGLClientBuffer client_buffer_type
Client buffer handle type.
Definition: config.hpp:83
egl_api_function< bool_type(display_type), nullptr > Terminate
Definition: c_api.hpp:175
egl_api_function< int_type(display_type, sync_type, int_type, time_type), nullptr > ClientWaitSync
Definition: c_api.hpp:458
typename egl_types::image_type image_type
Alias for image handle type.
Definition: c_api.hpp:102
egl_api_function< bool_type(int_type), nullptr > WaitNative
Definition: c_api.hpp:444
egl_api_function< bool_type(display_type, config_type, int_type, int_type *), nullptr > GetConfigAttrib
Definition: c_api.hpp:203
egl_api_function< surface_type(int_type), nullptr > GetCurrentSurface
Definition: c_api.hpp:259
egl_api_function< bool_type(display_type, context_type, int_type, int_type *), nullptr > QueryContext
Definition: c_api.hpp:434
egl_api_function< bool_type(display_type, int_type), nullptr > SwapInterval
Definition: c_api.hpp:512
egl_api_function< void(*(const char_type *))(), nullptr > GetProcAddress
Definition: c_api.hpp:134
egl_api_function< surface_type(display_type, stream_type), nullptr > DestroyStream
Definition: c_api.hpp:283
void * stream_type
Stream handle type.
Definition: config.hpp:63
EGLTime time_type
Time type.
Definition: config.hpp:107
egl_api_function< surface_type(display_type, config_type, const int_type *), nullptr > CreatePbufferSurface
Definition: c_api.hpp:224
egl_api_function< bool_type(int_type, device_type, int_type *), nullptr > QueryDevices
Definition: c_api.hpp:139
EGLAttrib attrib_type
Config attribute handle type.
Definition: config.hpp:92
egl_api_function< bool_type(display_type, output_port_type, int_type, attrib_type *), nullptr > QueryOutputPortAttrib
Definition: c_api.hpp:371
egl_api_function< bool_type(display_type, surface_type, native_pixmap_type), nullptr > CopyBuffers
Definition: c_api.hpp:505
egl_api_function< bool_type(), nullptr > ReleaseThread
Definition: c_api.hpp:531
ApiTraits api_traits
Alias for the API traits policy type passed as template argument.
Definition: c_api.hpp:37
egl_api_function< bool_type(display_type, surface_type, surface_type, context_type), nullptr > MakeCurrent
Definition: c_api.hpp:422
egl_api_function< const char_type *(display_type, output_port_type, int_type), nullptr > QueryOutputPortString
Definition: c_api.hpp:378
typename egl_types::display_type display_type
Alias for display handle type.
Definition: c_api.hpp:78
typename egl_types::context_type context_type
Alias for context handle type.
Definition: c_api.hpp:90
typename egl_types::native_window_type native_window_type
Alias for native window handle type.
Definition: c_api.hpp:69
egl_api_function< const char_type *(display_type), nullptr > GetDisplayDriverName
Definition: c_api.hpp:163
EGLint int_type
Signed integer type.
Definition: config.hpp:116
EGLBoolean bool_type
Boolean type.
Definition: config.hpp:110
egl_api_function< image_type(display_type, context_type, enum_type, client_buffer_type, const attrib_type *), nullptr > CreateImage
Definition: c_api.hpp:491
EGLImage image_type
EGL image type.
Definition: config.hpp:101
egl_api_function< bool_type(display_type, stream_type), nullptr > StreamConsumerGLTextureExternal
Definition: c_api.hpp:302
typename egl_types::void_ptr_type void_ptr_type
Untyped non-const pointer type.
Definition: c_api.hpp:42
egl_api_function< display_type(native_display_type), nullptr > GetDisplay
Definition: c_api.hpp:158
egl_api_function< bool_type(display_type, config_type *, int_type, int_type *), nullptr > GetConfigs
Definition: c_api.hpp:189
EGLDisplay display_type
EGL display handle type.
Definition: config.hpp:86
egl_api_function< surface_type(display_type, config_type, void_ptr_type, const attrib_type *), nullptr > CreatePlatformWindowSurface
Definition: c_api.hpp:210

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).