Kanzi 4.1.0
kanzi::platform Namespace Reference

Classes

class  AbstractWindowSurface
 Base class for surface-specific data. More...
 
class  AndroidPlatformContext
 Android platform context class. More...
 
struct  ApiBackendBasicInfo
 Stores basic information about API backend. More...
 
struct  ApiBackendVersion
 Represents API backend version. More...
 
class  EglEmscriptenGraphicsContext
 EGL implementation of GlGraphicsContext for Emscripten. More...
 
class  EglGraphicsContext
 EGL implementation of GlGraphicsContext. More...
 
class  EglOhosGraphicsContext
 EGL implementation of GlGraphicsContext for OpenHarmony OS. More...
 
class  EglQnxStreamsGraphicsContext
 EGL implementation of GlGraphicsContext for QNX streams. More...
 
class  EglWaylandGraphicsContext
 EGL implementation of GlGraphicsContext for Wayland. More...
 
class  EglX11GraphicsContext
 EGL implementation of GlGraphicsContext for X11. More...
 
class  EmscriptenPlatformContext
 Emscripten platform context class. More...
 
struct  GLFunctionPointers
 
class  GlGraphicsContext
 The OpenGL context API interface that is used by the OpenGL backend to interact with the platform. More...
 
class  GlxGraphicsContext
 GLX implementation of GlGraphicsContext. More...
 
class  MacosPlatformContext
 MacOS platform context class. More...
 
class  PlatformContext
 Kanzi platform context interface definition. More...
 
class  QnxPlatformContext
 QNX platform context class. More...
 
class  QnxStreamsSurface
 Surface abstraction for QNX streams. More...
 
class  StandardSurface
 Standard surface abstraction. More...
 
class  StubPlatformContext
 Stub platform context class. More...
 
struct  SurfaceBits
 Describes the bit representation of a surface buffer. More...
 
struct  SurfaceProperties
 Describes the properties of a surface. More...
 
class  WaylandPlatformContext
 Wayland platform context class. More...
 
class  WglGraphicsContext
 WGL implementation of GlGraphicsContext. More...
 
class  Win32PlatformContext
 Win32 platform context class. More...
 
class  X11PlatformContext
 X11 platform context class. More...
 

Typedefs

using EGLSurface
 Alias for different types of EGL surfaces.
 
template<typename Return = void, typename... Args>
using function_ptr
 
using NativeSurfaceHandle
 Information necessary for native surfaces such as windows.
 
template<typename Return = void, typename... Args>
using std_function_ptr
 

Enumerations

enum class  APIBackend : uint8_t {
  OpenGL , OpenGLES , Vulkan , Unknown ,
  Count
}
 Defines the available API backend implementations. More...
 
enum class  ColorSpace : uint8_t {
  sRGB , DisplayP3 , BT2020 , HDR10 ,
  Count
}
 Defines the color space options for an image or frame buffer. More...
 
enum class  MultisampleCount : uint8_t {
  NoMSAA , MSAAx2 , MSAAx4 , MSAAx8 ,
  MSAAx16 , MSAAx32
}
 Defines the available numbers of samples for multisample anti-aliasing (MSAA). More...
 
enum class  PlatformFeatureId { sRGBSurface , Count }
 Defines the platform features that can be present or missing on a specific platform. More...
 
enum class  PresentMode : uint8_t { Immediate , FIFO , FIFORelaxed , Mailbox }
 Defines the options for surface present mode. More...
 
enum class  SwapBehavior : uint8_t { Preserved , Destroyed , Unspecified }
 Defines the options for surface swap behavior. More...
 

Functions

KZ_NO_DISCARD SurfaceProperties asPlatformSurfaceProperties (const SystemConfiguration &configuration)
 Create a SurfaceProperties struct based on SystemConfiguration.
 
void createDefaultPlatformContext (const SystemConfiguration &configuration)
 Creates default PlatformContext singleton.
 
void destroyDefaultPlatformContext ()
 Destroys default PlatformContext singleton.
 
KZ_NO_DISCARD SharedLockedPtr< PlatformContextgetDefaultPlatformContext ()
 Queries default PlatformContext singleton.
 
template<typename Loader >
auto loadGlFunction (platform::GlGraphicsContext &glContextApi)
 Acquires a GL function pointer.
 
shared_ptr< GlGraphicsContextmakeDefaultGlGraphicsContext (PlatformContext &platformContext, GlGraphicsContext::InitializationInfo &&info)
 Creates the default OpenGL context API implementation for the current platform.
 
MultisampleCount toMultisampleCount (size_t sampleCount)
 Gets kanzi graphics multi sample count from an integral sample count.
 
string toString (PlatformFeatureId feature)
 Converts a PlatformFeatureId to a string.
 

Typedef Documentation

◆ NativeSurfaceHandle

Information necessary for native surfaces such as windows.

The underlying objects are platform specific, such as HWND on Windows, ANativeWindow* on Android, xcb_window_t on X11, wl_surface* on Wayland and so on.

Since
Kanzi 4.0.0

◆ function_ptr

template<typename Return = void, typename... Args>
using kanzi::platform::function_ptr

◆ EGLSurface

Alias for different types of EGL surfaces.

◆ std_function_ptr

template<typename Return = void, typename... Args>
using kanzi::platform::std_function_ptr

Enumeration Type Documentation

◆ MultisampleCount

Defines the available numbers of samples for multisample anti-aliasing (MSAA).

Since
Kanzi 4.0.0
Enumerator
NoMSAA 

Single sample. Disables MSAA.

MSAAx2 

MSAA with 2 samples.

MSAAx4 

MSAA with 4 samples.

MSAAx8 

MSAA with 8 samples.

MSAAx16 

MSAA with 16 samples.

MSAAx32 

MSAA with 32 samples.

◆ ColorSpace

Defines the color space options for an image or frame buffer.

Since
Kanzi 4.0.0
Enumerator
sRGB 

sRGB-encoded color (IEC 61966-2-1:1999).

DisplayP3 

P3-D65-encoded color.

BT2020 

BT.2020-encoded color.

HDR10 

HDR10-encoded color.

Count 

Number of ColorSpace options.

◆ SwapBehavior

Defines the options for surface swap behavior.

Since
Kanzi 4.0.0
Enumerator
Preserved 

Preserves the surface contents when swapped.

Destroyed 

Destroys the surface contents when swapped.

Unspecified 

Does not specify the surface contents when swapped.

◆ PresentMode

Defines the options for surface present mode.

Since
Kanzi 4.0.0
Enumerator
Immediate 

Swaps at any time. Tearing can occur.

FIFO 

Queues and swaps buffers in the order given during the VBLANK interval.

FIFORelaxed 

Behaves otherwise like FIFO, but if no image is available, the next image is Immediate.

This option prefers tearing over showing a stale image.

Mailbox 

Similar to FIFO, but only a single surface is in the queue.

If the second surface is prepared before the next VBLANK, replaces the surface.

◆ PlatformFeatureId

Defines the platform features that can be present or missing on a specific platform.

Since
Kanzi 4.0.0
Enumerator
sRGBSurface 

Whether an sRGB-encoded surface frame buffer is available.

Count 

Number of FeatureId options.

◆ APIBackend

Defines the available API backend implementations.

Since
Kanzi 4.0.0
Enumerator
OpenGL 

OpenGL.

OpenGLES 

OpenGL ES.

Vulkan 

Vulkan.

Unknown 

Unknown.

Count 

Number of APIBackend options.

Function Documentation

◆ toString()

string kanzi::platform::toString ( PlatformFeatureId feature)
inline

Converts a PlatformFeatureId to a string.

Parameters
featureThe platform feature id.
Returns
A string representation of the feature id.
Since
Kanzi 4.0.0

◆ toMultisampleCount()

MultisampleCount kanzi::platform::toMultisampleCount ( size_t sampleCount)
inline

Gets kanzi graphics multi sample count from an integral sample count.

Parameters
sampleCountThe integral sample count.
Returns
The kanzi graphics multi sample count.
Since
Kanzi 4.0.0

◆ loadGlFunction()

template<typename Loader >
auto kanzi::platform::loadGlFunction ( platform::GlGraphicsContext & glContextApi)

Acquires a GL function pointer.

If GL function is defined, returns a pointer to it. If GL function is not defined, acquires the pointer by using platform-specific xxxGetProcAddress().

Template Parameters
LoaderGL function loader generated by KANZI_GENERATE_GL_LOADER().
Parameters
glContextApiGL context API to use.
Returns
Proxy function pointer that can be used as a requested GL function pointer.
Since
Kanzi 4.0.0

◆ asPlatformSurfaceProperties()

KZ_NO_DISCARD SurfaceProperties kanzi::platform::asPlatformSurfaceProperties ( const SystemConfiguration & configuration)

Create a SurfaceProperties struct based on SystemConfiguration.

Returns
SurfaceProperties struct based on SystemConfiguration.
Since
Kanzi 4.0.0
Attention
This feature is experimental and is likely to change in future releases.

◆ createDefaultPlatformContext()

void kanzi::platform::createDefaultPlatformContext ( const SystemConfiguration & configuration)

Creates default PlatformContext singleton.

This function is thread-safe. This function blocks until all pointers returned from getDefaultPlatformContext() have been destructed.

Parameters
configurationSystem configuration.
Since
Kanzi 4.0.0
Attention
This feature is experimental and is likely to change in future releases.

◆ destroyDefaultPlatformContext()

void kanzi::platform::destroyDefaultPlatformContext ( )

Destroys default PlatformContext singleton.

This function is thread-safe. This function blocks until all pointers returned from getDefaultPlatformContext() have been destructed.

Since
Kanzi 4.0.0
Attention
This feature is experimental and is likely to change in future releases.

◆ getDefaultPlatformContext()

KZ_NO_DISCARD SharedLockedPtr< PlatformContext > kanzi::platform::getDefaultPlatformContext ( )

Queries default PlatformContext singleton.

This function is thread-safe. This function blocks while createDefaultPlatformContext() or destroyDefaultPlatformContext() is executing.

See also
createDefaultPlatformContext()
Returns
Shared locked pointer to the platform instance, or a null pointer if the platform instance has not been created. The platform instance singleton is guaranteed to be neither created nor destroyed while the return value exists.
Since
Kanzi 4.0.0
Attention
This feature is experimental and is likely to change in future releases.