Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
graphics.h File Reference

Declarations for graphics related functions. More...

#include <optional>
#include <string_view>
#include <glad/egl.h>
#include <glad/gl.h>
#include "misc.h"
#include "src/logging.h"
#include "src/platform/common.h"
#include "src/utility.h"
#include "src/video_colorspace.h"
Include dependency graph for graphics.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  gl::tex_t
class  gl::frame_buf_t
class  gl::shader_t
class  gl::buffer_t
class  gl::program_t
struct  egl::rgb_img_t
struct  egl::nv12_img_t
struct  egl::surface_descriptor_t
class  egl::cursor_t
class  egl::img_descriptor_t
class  egl::sws_t

Macros

#define HERMES_STRINGIFY_HELPER(x)
#define HERMES_STRINGIFY(x)
#define gl_drain_errors_helper(x)
#define gl_drain_errors   gl_drain_errors_helper(__FILE__ ":" HERMES_STRINGIFY(__LINE__))

Typedefs

using frame_t = util::safe_ptr<AVFrame, free_frame>
typedef void(*) gbm::device_destroy_fn(device *gbm)
typedef device *(*) gbm::create_device_fn(int fd)
using gbm::gbm_t = util::dyn_safe_ptr<device, &device_destroy>
using egl::display_t = util::dyn_safe_ptr_v2<void, EGLBoolean, &eglTerminate>

Functions

int close (int __fd)
void free_frame (AVFrame *frame)
void gl::drain_errors (const std::string_view &prefix)
int gbm::init ()
 egl::KITTY_USING_MOVE_T (rgb_t, rgb_img_t,, { if(el.xrgb8) { eglDestroyImage(el.display, el.xrgb8);} })
 egl::KITTY_USING_MOVE_T (nv12_t, nv12_img_t,, { if(el.r8) { eglDestroyImage(el.display, el.r8);} if(el.bg88) { eglDestroyImage(el.display, el.bg88);} })
 egl::KITTY_USING_MOVE_T (ctx_t,(std::tuple< display_t::pointer, EGLContext >),, { TUPLE_2D_REF(disp, ctx, el);if(ctx) { eglMakeCurrent(disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);eglDestroyContext(disp, ctx);} })
display_t egl::make_display (std::variant< gbm::gbm_t::pointer, wl_display *, _XDisplay * > native_display)
std::optional< ctx_t > egl::make_ctx (display_t::pointer display)
std::optional< rgb_t > egl::import_source (display_t::pointer egl_display, const surface_descriptor_t &xrgb)
rgb_t egl::create_blank (platf::img_t &img)
 Create a black RGB texture of the specified image size.
std::optional< nv12_t > egl::import_target (display_t::pointer egl_display, std::array< file_t, nv12_img_t::num_fds > &&fds, const surface_descriptor_t &y, const surface_descriptor_t &uv)
std::optional< nv12_t > egl::create_target (int width, int height, AVPixelFormat format)
 Create biplanar YUV textures to render into.
bool egl::fail ()

Detailed Description

Declarations for graphics related functions.

Definition in file graphics.h.

Macro Definition Documentation

◆ gl_drain_errors

#define gl_drain_errors   gl_drain_errors_helper(__FILE__ ":" HERMES_STRINGIFY(__LINE__))

Definition at line 25 of file graphics.h.

◆ gl_drain_errors_helper

#define gl_drain_errors_helper ( x)
Value:
gl::drain_errors(x)

Definition at line 24 of file graphics.h.

◆ HERMES_STRINGIFY

#define HERMES_STRINGIFY ( x)
Value:
HERMES_STRINGIFY_HELPER(x)

Definition at line 23 of file graphics.h.

◆ HERMES_STRINGIFY_HELPER

#define HERMES_STRINGIFY_HELPER ( x)
Value:
#x

Definition at line 22 of file graphics.h.

Typedef Documentation

◆ create_device_fn

typedef device *(*) gbm::create_device_fn(int fd)

Definition at line 171 of file graphics.h.

◆ device_destroy_fn

typedef void(*) gbm::device_destroy_fn(device *gbm)

Definition at line 170 of file graphics.h.

◆ display_t

using egl::display_t = util::dyn_safe_ptr_v2<void, EGLBoolean, &eglTerminate>

Definition at line 183 of file graphics.h.

◆ frame_t

using frame_t = util::safe_ptr<AVFrame, free_frame>

Definition at line 35 of file graphics.h.

◆ gbm_t

using gbm::gbm_t = util::dyn_safe_ptr<device, &device_destroy>

Definition at line 176 of file graphics.h.

Function Documentation

◆ create_blank()

rgb_t egl::create_blank ( platf::img_t & img)

Create a black RGB texture of the specified image size.

Parameters
imgThe image to use for texture sizing.
Returns
The new RGB texture.

Definition at line 621 of file graphics.cpp.

◆ create_target()

std::optional< nv12_t > egl::create_target ( int width,
int height,
AVPixelFormat format )

Create biplanar YUV textures to render into.

Creates biplanar YUV textures to render into.

Parameters
widthWidth of the target frame.
heightHeight of the target frame.
formatFormat of the target frame.
Returns
The new RGB texture.

Definition at line 704 of file graphics.cpp.

◆ drain_errors()

void gl::drain_errors ( const std::string_view & prefix)

Definition at line 35 of file graphics.cpp.

◆ fail()

bool egl::fail ( )

Definition at line 323 of file graphics.cpp.

◆ free_frame()

void free_frame ( AVFrame * frame)

Definition at line 1106 of file graphics.cpp.

◆ import_source()

std::optional< rgb_t > egl::import_source ( display_t::pointer egl_display,
const surface_descriptor_t & xrgb )

Definition at line 588 of file graphics.cpp.

◆ import_target()

std::optional< nv12_t > egl::import_target ( display_t::pointer egl_display,
std::array< file_t, nv12_img_t::num_fds > && fds,
const surface_descriptor_t & y,
const surface_descriptor_t & uv )

Definition at line 645 of file graphics.cpp.

◆ init()

int gbm::init ( )

Definition at line 270 of file graphics.cpp.

◆ make_ctx()

std::optional< ctx_t > egl::make_ctx ( display_t::pointer display)

Definition at line 406 of file graphics.cpp.