RetroArch
Macros | Functions | Variables
gl.c File Reference
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include <string.h>
#include <compat/strl.h>
#include <gfx/scaler/scaler.h>
#include <gfx/math/matrix_4x4.h>
#include <formats/image.h>
#include <retro_inline.h>
#include <retro_miscellaneous.h>
#include <retro_math.h>
#include <string/stdstring.h>
#include <libretro.h>
#include <gfx/gl_capabilities.h>
#include <gfx/video_frame.h>
#include <glsym/glsym.h>
#include "../../configuration.h"
#include "../../dynamic.h"
#include "../../record/record_driver.h"
#include "../../retroarch.h"
#include "../../verbosity.h"
#include "../common/gl_common.h"
#include "../font_driver.h"
Include dependency graph for gl.c:

Macros

#define GL_UNSIGNED_INT_8_8_8_8_REV   0x8367
 
#define set_texture_coords(coords, xamt, yamt)
 
#define gl_context_bind_hw_render(gl, enable)
 

Functions

void context_bind_hw_render (void *data, bool enable)
 
static void gl_set_projection (gl_t *gl, struct video_ortho *ortho, bool allow_rotate)
 
void gl_set_viewport (gl_t *gl, video_frame_info_t *video_info, unsigned viewport_width, unsigned viewport_height, bool force_full, bool allow_rotate)
 
static void gl_set_viewport_wrapper (void *data, unsigned viewport_width, unsigned viewport_height, bool force_full, bool allow_rotate)
 
static bool gl_shader_init (gl_t *gl, const gfx_ctx_driver_t *ctx_driver, struct retro_hw_render_callback *hwr)
 
static uintptr_t gl_get_current_framebuffer (void *data)
 
static void gl_set_rotation (void *data, unsigned rotation)
 
static void gl_set_video_mode (void *data, unsigned width, unsigned height, bool fullscreen)
 
static void gl_update_input_size (gl_t *gl, unsigned width, unsigned height, unsigned pitch, bool clear)
 
static void gl_init_textures_data (gl_t *gl)
 
static void gl_init_textures (gl_t *gl, const video_info_t *video)
 
static INLINE void gl_set_shader_viewports (gl_t *gl)
 
void gl_load_texture_data (uint32_t id_data, enum gfx_wrap_type wrap_type, enum texture_filter_type filter_type, unsigned alignment, unsigned width, unsigned height, const void *frame, unsigned base_size)
 
static void gl_set_texture_frame (void *data, const void *frame, bool rgb32, unsigned width, unsigned height, float alpha)
 
static void gl_set_texture_enable (void *data, bool state, bool full_screen)
 
static void gl_render_osd_background (gl_t *gl, video_frame_info_t *video_info, const char *msg)
 
static void gl_set_osd_msg (void *data, video_frame_info_t *video_info, const char *msg, const void *params, void *font)
 
static void gl_show_mouse (void *data, bool state)
 
static struct video_shadergl_get_current_shader (void *data)
 
static void gl_pbo_async_readback (gl_t *gl)
 
static bool gl_frame (void *data, const void *frame, unsigned frame_width, unsigned frame_height, uint64_t frame_count, unsigned pitch, const char *msg, video_frame_info_t *video_info)
 
static void gl_destroy_resources (gl_t *gl)
 
static void gl_deinit_chain (gl_t *gl)
 
static void gl_free (void *data)
 
static void gl_set_nonblock_state (void *data, bool state)
 
static bool resolve_extensions (gl_t *gl, const char *context_ident, const video_info_t *video)
 
static INLINE void gl_set_texture_fmts (gl_t *gl, bool rgb32)
 
static bool gl_init_pbo_readback (gl_t *gl)
 
static const gfx_ctx_driver_tgl_get_context (gl_t *gl)
 
static bool renderchain_gl_init_first (const gl_renderchain_driver_t **renderchain_driver, void **renderchain_handle)
 
static voidgl_init (const video_info_t *video, const input_driver_t **input, void **input_data)
 
static bool gl_alive (void *data)
 
static bool gl_suppress_screensaver (void *data, bool enable)
 
static void gl_update_tex_filter_frame (gl_t *gl)
 
static bool gl_set_shader (void *data, enum rarch_shader_type type, const char *path)
 
static void gl_viewport_info (void *data, struct video_viewport *vp)
 
static bool gl_read_viewport (void *data, uint8_t *buffer, bool is_idle)
 
static retro_proc_address_t gl_get_proc_address (void *data, const char *sym)
 
static void gl_set_aspect_ratio (void *data, unsigned aspect_ratio_idx)
 
static void gl_apply_state_changes (void *data)
 
static void gl_get_video_output_size (void *data, unsigned *width, unsigned *height)
 
static void gl_get_video_output_prev (void *data)
 
static void gl_get_video_output_next (void *data)
 
static void video_texture_load_gl (struct texture_image *ti, enum texture_filter_type filter_type, uintptr_t *id)
 
static uintptr_t gl_load_texture (void *video_data, void *data, bool threaded, enum texture_filter_type filter_type)
 
static void gl_unload_texture (void *data, uintptr_t id)
 
static void gl_set_coords (void *handle_data, void *shader_data, const struct video_coords *coords)
 
static float gl_get_refresh_rate (void *data)
 
static void gl_set_mvp (void *data, void *shader_data, const void *mat_data)
 
static uint32_t gl_get_flags (void *data)
 
static void gl_get_poke_interface (void *data, const video_poke_interface_t **iface)
 

Variables

static struct video_ortho default_ortho = {0, 1, 0, 1, -1, 1}
 
static const GLfloat vertexes_flipped []
 
static const GLfloat vertexes []
 
static const GLfloat tex_coords []
 
static const GLfloat white_color []
 
static bool gl_shared_context_use = false
 
gl_renderchain_driver_t gl2_renderchain
 
static const gl_renderchain_driver_trenderchain_gl_drivers []
 
static const video_poke_interface_t gl_poke_interface
 
video_driver_t video_gl
 

Macro Definition Documentation

◆ gl_context_bind_hw_render

#define gl_context_bind_hw_render (   gl,
  enable 
)
Value:
gl->ctx_driver->bind_hw_render(gl->ctx_data, enable)
GLboolean enable
Definition: glext.h:12027
void * ctx_data
Definition: gl_common.h:320
static bool gl_shared_context_use
Definition: gl.c:119
Definition: gl_common.h:236

◆ GL_UNSIGNED_INT_8_8_8_8_REV

#define GL_UNSIGNED_INT_8_8_8_8_REV   0x8367

◆ set_texture_coords

#define set_texture_coords (   coords,
  xamt,
  yamt 
)
Value:
coords[2] = xamt; \
coords[6] = xamt; \
coords[5] = yamt; \
coords[7] = yamt
GLuint coords
Definition: glext.h:8035

Function Documentation

◆ context_bind_hw_render()

void context_bind_hw_render ( void data,
bool  enable 
)
Here is the caller graph for this function:

◆ gl_alive()

static bool gl_alive ( void data)
static
Here is the call graph for this function:

◆ gl_apply_state_changes()

static void gl_apply_state_changes ( void data)
static

◆ gl_deinit_chain()

static void gl_deinit_chain ( gl_t gl)
static
Here is the caller graph for this function:

◆ gl_destroy_resources()

static void gl_destroy_resources ( gl_t gl)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_frame()

static bool gl_frame ( void data,
const void frame,
unsigned  frame_width,
unsigned  frame_height,
uint64_t  frame_count,
unsigned  pitch,
const char *  msg,
video_frame_info_t video_info 
)
static
Here is the call graph for this function:

◆ gl_free()

static void gl_free ( void data)
static
Here is the call graph for this function:

◆ gl_get_context()

static const gfx_ctx_driver_t* gl_get_context ( gl_t gl)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_get_current_framebuffer()

static uintptr_t gl_get_current_framebuffer ( void data)
static

◆ gl_get_current_shader()

static struct video_shader* gl_get_current_shader ( void data)
static
Here is the call graph for this function:

◆ gl_get_flags()

static uint32_t gl_get_flags ( void data)
static

◆ gl_get_poke_interface()

static void gl_get_poke_interface ( void data,
const video_poke_interface_t **  iface 
)
static
Here is the call graph for this function:

◆ gl_get_proc_address()

static retro_proc_address_t gl_get_proc_address ( void data,
const char *  sym 
)
static
Here is the call graph for this function:

◆ gl_get_refresh_rate()

static float gl_get_refresh_rate ( void data)
static
Here is the call graph for this function:

◆ gl_get_video_output_next()

static void gl_get_video_output_next ( void data)
static
Here is the call graph for this function:

◆ gl_get_video_output_prev()

static void gl_get_video_output_prev ( void data)
static
Here is the call graph for this function:

◆ gl_get_video_output_size()

static void gl_get_video_output_size ( void data,
unsigned *  width,
unsigned *  height 
)
static
Here is the call graph for this function:

◆ gl_init()

static void* gl_init ( const video_info_t video,
const input_driver_t **  input,
void **  input_data 
)
static
Here is the call graph for this function:

◆ gl_init_pbo_readback()

static bool gl_init_pbo_readback ( gl_t gl)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_init_textures()

static void gl_init_textures ( gl_t gl,
const video_info_t video 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_init_textures_data()

static void gl_init_textures_data ( gl_t gl)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_load_texture()

static uintptr_t gl_load_texture ( void video_data,
void data,
bool  threaded,
enum texture_filter_type  filter_type 
)
static
Here is the call graph for this function:

◆ gl_load_texture_data()

void gl_load_texture_data ( uint32_t  id_data,
enum gfx_wrap_type  wrap_type,
enum texture_filter_type  filter_type,
unsigned  alignment,
unsigned  width,
unsigned  height,
const void frame,
unsigned  base_size 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_pbo_async_readback()

static void gl_pbo_async_readback ( gl_t gl)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_read_viewport()

static bool gl_read_viewport ( void data,
uint8_t buffer,
bool  is_idle 
)
static

◆ gl_render_osd_background()

static void gl_render_osd_background ( gl_t gl,
video_frame_info_t video_info,
const char *  msg 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_set_aspect_ratio()

static void gl_set_aspect_ratio ( void data,
unsigned  aspect_ratio_idx 
)
static
Here is the call graph for this function:

◆ gl_set_coords()

static void gl_set_coords ( void handle_data,
void shader_data,
const struct video_coords coords 
)
static

◆ gl_set_mvp()

static void gl_set_mvp ( void data,
void shader_data,
const void mat_data 
)
static

◆ gl_set_nonblock_state()

static void gl_set_nonblock_state ( void data,
bool  state 
)
static
Here is the call graph for this function:

◆ gl_set_osd_msg()

static void gl_set_osd_msg ( void data,
video_frame_info_t video_info,
const char *  msg,
const void params,
void font 
)
static
Here is the call graph for this function:

◆ gl_set_projection()

static void gl_set_projection ( gl_t gl,
struct video_ortho ortho,
bool  allow_rotate 
)
static
Here is the caller graph for this function:

◆ gl_set_rotation()

static void gl_set_rotation ( void data,
unsigned  rotation 
)
static
Here is the call graph for this function:

◆ gl_set_shader()

static bool gl_set_shader ( void data,
enum rarch_shader_type  type,
const char *  path 
)
static
Here is the call graph for this function:

◆ gl_set_shader_viewports()

static INLINE void gl_set_shader_viewports ( gl_t gl)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_set_texture_enable()

static void gl_set_texture_enable ( void data,
bool  state,
bool  full_screen 
)
static

◆ gl_set_texture_fmts()

static INLINE void gl_set_texture_fmts ( gl_t gl,
bool  rgb32 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_set_texture_frame()

static void gl_set_texture_frame ( void data,
const void frame,
bool  rgb32,
unsigned  width,
unsigned  height,
float  alpha 
)
static
Here is the call graph for this function:

◆ gl_set_video_mode()

static void gl_set_video_mode ( void data,
unsigned  width,
unsigned  height,
bool  fullscreen 
)
static
Here is the call graph for this function:

◆ gl_set_viewport()

void gl_set_viewport ( gl_t gl,
video_frame_info_t video_info,
unsigned  viewport_width,
unsigned  viewport_height,
bool  force_full,
bool  allow_rotate 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_set_viewport_wrapper()

static void gl_set_viewport_wrapper ( void data,
unsigned  viewport_width,
unsigned  viewport_height,
bool  force_full,
bool  allow_rotate 
)
static
Here is the call graph for this function:

◆ gl_shader_init()

static bool gl_shader_init ( gl_t gl,
const gfx_ctx_driver_t ctx_driver,
struct retro_hw_render_callback hwr 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_show_mouse()

static void gl_show_mouse ( void data,
bool  state 
)
static
Here is the call graph for this function:

◆ gl_suppress_screensaver()

static bool gl_suppress_screensaver ( void data,
bool  enable 
)
static
Here is the call graph for this function:

◆ gl_unload_texture()

static void gl_unload_texture ( void data,
uintptr_t  id 
)
static

◆ gl_update_input_size()

static void gl_update_input_size ( gl_t gl,
unsigned  width,
unsigned  height,
unsigned  pitch,
bool  clear 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_update_tex_filter_frame()

static void gl_update_tex_filter_frame ( gl_t gl)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gl_viewport_info()

static void gl_viewport_info ( void data,
struct video_viewport vp 
)
static
Here is the call graph for this function:

◆ renderchain_gl_init_first()

static bool renderchain_gl_init_first ( const gl_renderchain_driver_t **  renderchain_driver,
void **  renderchain_handle 
)
static
Here is the caller graph for this function:

◆ resolve_extensions()

static bool resolve_extensions ( gl_t gl,
const char *  context_ident,
const video_info_t video 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ video_texture_load_gl()

static void video_texture_load_gl ( struct texture_image ti,
enum texture_filter_type  filter_type,
uintptr_t id 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ default_ortho

struct video_ortho default_ortho = {0, 1, 0, 1, -1, 1}
static

◆ gl2_renderchain

◆ gl_poke_interface

const video_poke_interface_t gl_poke_interface
static
Initial value:
= {
NULL,
}
static void gl_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen)
Definition: gl.c:454
static float gl_get_refresh_rate(void *data)
Definition: gl.c:2575
static retro_proc_address_t gl_get_proc_address(void *data, const char *sym)
Definition: gl.c:2417
static void gl_set_texture_frame(void *data, const void *frame, bool rgb32, unsigned width, unsigned height, float alpha)
Definition: gl.c:673
static void gl_set_texture_enable(void *data, bool state, bool full_screen)
Definition: gl.c:704
static void gl_set_mvp(void *data, void *shader_data, const void *mat_data)
Definition: gl.c:2583
#define NULL
Pointer to 0.
Definition: gctypes.h:65
static struct video_shader * gl_get_current_shader(void *data)
Definition: gl.c:844
static void gl_get_video_output_prev(void *data)
Definition: gl.c:2480
static uintptr_t gl_load_texture(void *video_data, void *data, bool threaded, enum texture_filter_type filter_type)
Definition: gl.c:2529
static void gl_apply_state_changes(void *data)
Definition: gl.c:2462
static uint32_t gl_get_flags(void *data)
Definition: gl.c:2592
static void gl_unload_texture(void *data, uintptr_t id)
Definition: gl.c:2556
static void gl_get_video_output_next(void *data)
Definition: gl.c:2485
static void gl_set_coords(void *handle_data, void *shader_data, const struct video_coords *coords)
Definition: gl.c:2566
static uintptr_t gl_get_current_framebuffer(void *data)
Definition: gl.c:435
static void gl_show_mouse(void *data, bool state)
Definition: gl.c:839
static void gl_set_osd_msg(void *data, video_frame_info_t *video_info, const char *msg, const void *params, void *font)
Definition: gl.c:831
static void gl_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
Definition: gl.c:2429
static void gl_get_video_output_size(void *data, unsigned *width, unsigned *height)
Definition: gl.c:2471

◆ gl_shared_context_use

bool gl_shared_context_use = false
static

◆ renderchain_gl_drivers

const gl_renderchain_driver_t* renderchain_gl_drivers[]
static
Initial value:
= {
}
#define NULL
Pointer to 0.
Definition: gctypes.h:65
gl_renderchain_driver_t gl2_renderchain
Definition: gl2_renderchain.c:1516

◆ tex_coords

const GLfloat tex_coords[]
static
Initial value:
= {
0, 0,
1, 0,
0, 1,
1, 1
}

◆ vertexes

const GLfloat vertexes[]
static
Initial value:
= {
0, 0,
1, 0,
0, 1,
1, 1
}

◆ vertexes_flipped

const GLfloat vertexes_flipped[]
static
Initial value:
= {
0, 1,
1, 1,
0, 0,
1, 0
}

◆ video_gl

video_driver_t video_gl

◆ white_color

const GLfloat white_color[]
static
Initial value:
= {
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
}